VB.net Concurrency Violation Error
Posted on 2010-11-26
I have a VB.net 2010 application that is running against a SQL Server 2008 database. I have over 4000 records in this database that have been created using this application. However, a handful of the records will not update after some unknown event happens to them. I get the error "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records." However for testing, I am working in a local copy of the database, no one else is logged in, and I only get this message on certain records. I can edit the record in the back end on the database without error, even changing the same values that I am attempting to edit through the application. This is all generated code, nothing fancy in the SQL or the Update Logic. I even removed all table triggers from the table I'm updating just to make sure it wasn't an error embedded in some other business logic. I've tried setting the transaction isolation levels to every available level without any change in this behavior.
Attached you will find the generated update statement, data captured for the rows before and after values, and a set of the code used to do the work. I'm only changing a value in one text column for the purpose of the test.
Please advise any ideas on this issue.