没看过你写的代码,你看看更新的sql语句是不是有问题,仔细调试一下
这是我写的一个例子,你看下对你有没有帮助。。。
//更新
protected void gv_user_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow gvr = gv_user.Rows[e.RowIndex];
//获取用户名
string uname = ((TextBox)gvr.Cells[0].FindControl("txt_uname")).Text;
//获取用户密码
string upwd = ((TextBox)gvr.Cells[1].FindControl("txt_upwd")).Text;
int id = Convert.ToInt32(gv_user.DataKeys[e.RowIndex].Value.ToString());
if (bll.UpdateUserByUid(uname,upwd,id))
{
gv_user.EditIndex = -1;
Bind();
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "msg", "");
}
}