修改DataGridView
内的数据时,我得到例外:
DBConcurrencyException: Concurrency violation: the UpdateCommand affected 0 of the expected 1 records
当我这样做时:
// myTable is the DataSource of the datagridview.
myAdapter.Update(myTable);
VS2010调试器在尝试更新时告诉我这是updateCommand
:
UPDATE `MySchema`.`MyDatabase`
SET `EmployeeFirstName` = @p1
WHERE ((`ID` = @p2) AND (`EmployeePhoneNumber` = @p3) AND
(`EmployeeFirstName` = @p4))
@p1 is Joe (new value changed in the datagridview)
@p4 is Sally (database value)
问题:
如果数据库中存在DBConcurrencyException
子句,为什么会得到WHERE
? (没有实际更改,因此没有任何并发冲突)