views:

31

answers:

1

When I run

DB.SubmitChanges();

I occasionally get an error that reads: "Row not found or changed". The reason why this error bugs me so much is because there will always a row that should be found for this query, and changes are only made if there are new changes to make.

I can't seem to figure out why this error pops up Are there some common reasons why this error shows up that I can try to find in my code?

+1  A: 

There could be 2 reasons:

  • the Row was deleted
  • the row was changed by another client

Both are due to concurrency, the first thing to check is if this could indeed be a multi-user issue.

Henk Holterman
Is it good practice to define many changes and have one DB.SubmitChanges(); or define many changes and have one DB.SubmitChanges(); after each change defined?
Soo
It depends (on your business requirements). Batching the changes will be more efficient but also increases the likelihood another process made changes. But you will have to deal with that anyhow.
Henk Holterman