houtai/add_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 add_category : System.Web.UI.Page
{
SQLHelper db = new SQLHelper();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bind();
}
}
public void bind()
{
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();
}
//
protected void Button2_Click(object sender, EventArgs e)
{
this.txt_category.Text = "";
}
protected void Button1_Click(object sender, EventArgs e)
{
int big_id = int.Parse(this.ddl_big.SelectedValue.ToString());
string category = this.txt_category.Text.ToString();
string sql = "insert into category(big_id,category) values('"+big_id+"','"+category+"')";
db.ExecuteNonQuery(sql, CommandType.Text);
Response.Write("<script>alert('添加成功!');location='add_category.aspx'</script>");
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。