DBConcurrencyException MySqlCommandBuilder

时间:2012-09-17 05:18:45

标签: c# mysql

修改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? (没有实际更改,因此没有任何并发​​冲突)

0 个答案:

没有答案