注册 登录
编程论坛 ASP.NET技术论坛

高手帮忙看下,修改不出错误,但是不能改数据.

cxjyw 发布于 2008-05-12 18:45, 752 次点击
高手帮忙看下,修改不出错误,但是不能改数据.代码如下,

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataSet ds = bc.getdataset("select * from admin where id ='" + Request.QueryString["id"] + "'", "admin");
            DataRow[] row = ds.Tables[0].Select();
            foreach (DataRow rs in row)
            {
                TextBox1.Text = rs["username"].ToString();
                TextBox2.Text = rs["userpwd"].ToString();
                TextBox3.Text = rs["flog"].ToString();
            }
        }

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        bc.execsql("update admin set username = '" + TextBox1.Text + "',userpwd='" + TextBox2.Text + "',flog='" + TextBox3.Text + "'' where id='" + Request.QueryString["id"] + "'");
        Response.Write("<script language=javascript>alert('修改成功!');location.href='list.aspx'</script>");
    }

会显示修改成功,但是数据库中的数据就是不发生变化.
1 回复
#2
beniao2008-05-13 21:42
回复 1# 的帖子
bc.execsql("update admin set username = '" + TextBox1.Text + "',userpwd='" + TextBox2.Text + "',flog='" + TextBox3.Text + "'' where id='" + Request.QueryString["id"] + "'");


那多半就是你这句代码没执行过..
 调试下这句代码
1