dataset数据删除问题
SqlConnection Myconnection=new SqlConnection(DataBaseDB.ConnectionString);string cmdText="select * from RoleNewsKinds where RoleID='"+drRoleList.SelectedValue+"'";
SqlCommand Mycommand=new SqlCommand(cmdText,Myconnection);
SqlDataAdapter Mydata=new SqlDataAdapter (Mycommand);
DataSet Mydas=new DataSet ();
Mydata.Fill(Mydas,"Table1"); Response.Write(Mydas.Tables["Table1"].Rows.Count);
Mydas.Tables["Table1"].Rows.Clear();//注意问题出现
Response.Write(Mydas.Tables["Table1"].Rows.Count);
//int j=Mydas.Tables["Table1"].Rows.Count;
//for(int i=0;i<j;i++)
//{
// Mydas.Tables["Table1"].Rows[i].Delete();
//}
SqlCommandBuilder Mycb=new SqlCommandBuilder (Mydata);
Mydata.Update(Mydas,"Table1");
Myconnection.Close();
dataset中的rows.clear();更新后数据库中的数据没有改变
但是用注释的掉的语句做就可以,不知道为什么?
希望高手给指点一下.谢谢!