admin/edit_depot.aspx.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
namespace 仓库管理系统.admin
{
    public partial class edit_depot : System.Web.UI.Page
    {
        SQLHelper db = new SQLHelper();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bind();
            }
        }
        //
        public void bind()
        {
            int id = int.Parse(Request.QueryString["id"].ToString());
            string sql = "select * from depot where depot_id=" + id;//构造选出行业所有字段的SQL语句
            DataTable dt = db.ExecuteQuery(sql, CommandType.Text);
            this.txt_zh.Text = dt.Rows[0]["zh"].ToString();
            this.txt_mima.Text = dt.Rows[0]["mima"].ToString();
            this.txt_name.Text = dt.Rows[0]["name"].ToString();
            this.txt_depot.Text = dt.Rows[0]["depot"].ToString();
            this.txt_wz.Text = dt.Rows[0]["wz"].ToString();
        }
        //
        protected void Button1_Click(object sender, EventArgs e)
        {
            int id = int.Parse(Request.QueryString["id"].ToString());
            string depot = this.txt_depot.Text.ToString();
            string wz = this.txt_wz.Text.ToString();
            string zh = this.txt_zh.Text.ToString();
            string mima = this.txt_mima.Text.ToString();
            string name = this.txt_name.Text.ToString();
            string sql = "update depot set depot='" + depot + "',wz='" + wz + "',zh='" + zh + "',mima='" + mima + "',name='" + name + "' where depot_id="+id;
            int s = db.ExecuteNonQuery(sql, CommandType.Text);
            Response.Write("<script>alert('成功!');location='depotlist.aspx'</script>");
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。