Concurrency violation: the UpdateCommand affected 0 of the expected 1 records. DB concurrencyException was unhandled

浪尽此生 提交于 2019-12-02 08:37:56

Your information supplied is useless. But I can explain the meaning of the error.

Every update command written in ADO.Net is of the form:

Update col1, col2 where col1=col1value AND col2=col2value

ADO.Net keeps the value of the column when it was selected from the database. When it performs the update the condition is that none of the columns have changed when you commit.

The reason you see the error is because the database row has changed in between you performing the select and calling da2.UpdateChanges(ds2). If you look at the logic perhaps you have selected the value for the row into two separate datasets (or in two different threads) and performed an update to it after performing the select.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!