asp.net(c#)——gridviewk可以进入编辑状态但是不能够保存
//更新代码//更新protectedvoidGvwpolitical_RowUpdating(objectsender,GridViewUpdateEventArgse...
//更新代码
//更新
protected void Gvwpolitical_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string sql2 = "update tb_politicsStatus set politicsStatus='"
+ ((TextBox)(Gvwpolitical.Rows[e.RowIndex].Cells[0].Controls[0])).Text.ToString() + "' where politicsStatusID='"
+ Gvwpolitical.DataKeys[e.RowIndex].Value.ToString() + "'";
SqlData da2 = new SqlData();
da2.ExceSQL(sql2);
Gvwpolitical.EditIndex = -1;
Gvwpolitical.DataKeyNames = new string[] { "politicsStatusID" };//主键
SqlData da = new SqlData();
da.BindData(this.Gvwpolitical, sql);
}
//数据库
不知道哪里出错了
已解决 展开
//更新
protected void Gvwpolitical_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string sql2 = "update tb_politicsStatus set politicsStatus='"
+ ((TextBox)(Gvwpolitical.Rows[e.RowIndex].Cells[0].Controls[0])).Text.ToString() + "' where politicsStatusID='"
+ Gvwpolitical.DataKeys[e.RowIndex].Value.ToString() + "'";
SqlData da2 = new SqlData();
da2.ExceSQL(sql2);
Gvwpolitical.EditIndex = -1;
Gvwpolitical.DataKeyNames = new string[] { "politicsStatusID" };//主键
SqlData da = new SqlData();
da.BindData(this.Gvwpolitical, sql);
}
//数据库
不知道哪里出错了
已解决 展开
1个回答
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询