admin/edit_kc.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_kc : System.Web.UI.Page
    {
        SQLHelper db = new SQLHelper();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bind();
            }
        }
        //
        public void bind()
        {

            int id = Convert.ToInt32(Request.QueryString["id"].ToString());
            string cx = "select * from kc where kc_id=" + id;
            DataTable dt = db.ExecuteQuery(cx, CommandType.Text);
            this.txt_kc.Text = dt.Rows[0]["kc"].ToString();
            //
        }
        //
        protected void Button1_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(Request.QueryString["id"].ToString());
            string kc = this.txt_kc.Text.ToString();
            string sql = "update kc set kc='" + kc + "' where kc_id=" + id;
            int d = db.ExecuteNonQuery(sql, CommandType.Text);
            Response.Write("<script>alert('修改成功!');location='kclist.aspx'</script>");
        }
    }
}

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

AI 解读 AI

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

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