DATAGRID的数据更新问题...我搜了答案...都和我的问题不一样
更新的代码如下:
public void DataGrid1_Update(object sender,DataGridCommandEventArgs E)
{
database db=new database();
String i;
i=((TextBox)E.Item.Cells[1].Controls[0]).Text;
Response.Write(i);
Response.End();
String sql="update arttype set typeid='"+Int32.Parse(i)+"' where id="+DataGrid1.DataKeys[(int)E.Item.ItemIndex];
if(db.Db_ExecuteNonquery(sql))
{
Label1.Text="更新成功.....";
databand();
}
else
{
Label1.Text="更新失败......";
databand();
}
}
感觉不到是其他地方的问题,database类在其他地方都可以使用,response.write(i);是我为了测试输入框的值写的,去掉这个Response.Write(i);Response.End();这两句,可以在label1上显示更新成功.....问题就是值没有变..还是原来绑定的值....
以前我都新建页面来进行更新,这次做datagrid的更新就没办法了....不知道是怎么回事