houtai/categorylist.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 电子商务.houtai
{
    public partial class categorylist : 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 category order by c_id desc";
            DataTable dt = db.ExecuteQuery(sql, CommandType.Text);
            this.gv.DataSource =dt;
            this.gv.DataBind();
        }
        //
        public string bind_big(int id)
        {
            string s;
            string sql = "select * from bigcategory where big_id=@id";
            SqlParameter[] paras = new SqlParameter[] 
               { 
            new SqlParameter("@id",id),
               };
            DataTable dt = db.ExecuteQuery(sql, paras, CommandType.Text);
            s = dt.Rows[0]["bigcategory"].ToString();
            return s;
        }
        //
        protected void gv_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int id = Convert.ToInt32(this.gv.DataKeys[e.RowIndex].Value.ToString());
            string sql = "delete from category where c_id=" + id;
            db.ExecuteNonQuery(sql, CommandType.Text);
            bind();
        }
    }
}

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

AI 解读 AI

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

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