private void Form1_Load(object sender, System.EventArgs e)
{
    SqlConnection  conn =new SqlConnection( "server=127.0.0.1;uid=sa;pwd=sa;database=aa");
            SqlCommand myUpdateCommand = conn.CreateCommand();
SqlCommand mySelectCommand = conn.CreateCommand();
SqlCommand myInsertCommand = conn.CreateCommand();
SqlCommand myDeleteCommand = conn.CreateCommand();
mySelectCommand.CommandText = "select * from mm ";
myInsertCommand.CommandText = "insert mm(a1) values(@a1)";
  myUpdateCommand.CommandText = "update mm   set a1 = @a1 where a1=@a1";
myDeleteCommand.CommandText = "delete from mm   where a1 = @a1";
  myInsertCommand.Parameters.Add("@a1",SqlDbType.Int,10,"a1");
myUpdateCommand.Parameters.Add("@a1",SqlDbType.Int ,10 ,"a1");
myDeleteCommand.Parameters.Add("@a1",SqlDbType.Int,10,"a1");
    da = new SqlDataAdapter();
da.SelectCommand = mySelectCommand;
da.InsertCommand = myInsertCommand;
da.UpdateCommand = myUpdateCommand;
da.DeleteCommand = myDeleteCommand;
da.Fill(ds,"请指教");
dataGrid1.SetDataBinding(ds,ds.Tables[0].TableName);
}
         DataSet ds =new DataSet();
         SqlDataAdapter da ;
private void button1_Click(object sender, System.EventArgs e)
{
    da.Update(ds,ds.Tables[0].TableName);
}
上面的这个例子:为什么更改dataGrid中的内容,再点更新,就也异常:“并发冲突"。
而添加一行的话,点更新,就可以真的更新。为什么啊???????????????????????