为什么update更新不了数据啊,,
void dg_Cancel(Object Sender,DataGridCommandEventArgs e){
dg.EditItemIndex=-1;
dg.DataSource=thisDS;
dg.DataBind();
}
void dg_Update(Object Sender,DataGridCommandEventArgs e)
{
datacon();
int i=e.Item.ItemIndex;
TextBox thisBox=(TextBox)e.Item.FindControl("idbox");
thisDS.Tables["students"].Rows[i]["id"]=thisBox.Text;
thisBox=(TextBox)e.Item.FindControl("namebox");
thisDS.Tables["students"].Rows[i]["name"]=thisBox.Text;
thisBox=(TextBox)e.Item.FindControl("classbox");
thisBox=(TextBox)e.Item.FindControl("gradebox");
thisDS.Tables["students"].Rows[i]["grade"]=thisBox.Text;
thisBox=(TextBox)e.Item.FindControl("classbox");
thisDS.Tables["students"].Rows[i]["school"]=thisBox.Text;
thisBox=(TextBox)e.Item.FindControl("sexbox");
thisDS.Tables["students"].Rows[i]["sex"]=thisBox.Text;
OleDbCommandBuilder thisBD=new OleDbCommandBuilder(thisAdapter);
thisAdapter.SelectCommand.CommandText="Select * from students";
thisBD.RefreshSchema();
thisAdapter.UpdateCommand=thisBD.GetUpdateCommand();
thisAdapter.Update(thisDS,"students");
thisDS.Clear();
thisAdapter.Fill(thisDS,"students");
dg.DataSource=thisDS;
dg.DataBind();
}
在DataGrid中更新数据,但点击Upate命令之后,不会更新数据,,到底错在哪啊,请指教了。。。Thanks................