0

在修改内部数据时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)

问题:

为什么我得到一个DBConcurrencyExceptionifWHERE子句存在于数据库中?(没有实际变化,因此没有任何并发​​冲突)

4

0 回答 0