houtai/edit_category.aspx.cs
(完整代码) 1KBusing 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 电子商务.houtai
{
public partial class edit_category : 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 cx = "select * from category where c_id=" + id;
DataTable d = db.ExecuteQuery(cx, CommandType.Text);
this.txt_category.Text = d.Rows[0]["category"].ToString();
//
string sql = "select * from bigcategory";
DataTable dt = db.ExecuteQuery(sql, CommandType.Text);
this.ddl_big.DataSource = dt;
this.ddl_big.DataTextField = "bigcategory";
this.ddl_big.DataValueField = "big_id";
this.ddl_big.DataBind();
this.ddl_big.Items.FindByValue(d.Rows[0]["big_id"].ToString()).Selected = true;
//
}
protected void Button1_Click(object sender, EventArgs e)
{
int id = int.Parse(Request.QueryString["id"].ToString());
int big_id = int.Parse(this.ddl_big.SelectedValue.ToString());
string category = this.txt_category.Text.ToString();
string sql = "update category set big_id='"+big_id+"',category='"+category+"' where c_id="+id;
db.ExecuteNonQuery(sql, CommandType.Text);
Response.Redirect("categorylist.aspx");
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。