LINQ to SQL - ‘Row not found or changed‘

This System.Data.Linq.Changeconflictexception with the message ‘Row not found or changed‘ appears to be a very annoying bug or error, but this is not the first time that i am getting this error while updating database record with Linq to SQL on ASP.NET. I tried to re-drag SQL tables from server explorer to the designer and rebuild the solution. I am still getting the ‘Row not found or changed’; there is a lack of details.
Reading on other blogs, found this from readme:
Tables with columns of type DateTime with higher precision than seconds do not update correctly. Blinq creates BoundField objects for DateTime fields that do not contain precision beyond seconds, so updates with DateTime fields with high precision that participate in optimistic concurrency fail. To fix this, do one of the following:
Change the precision displayed by the BoundField object by setting DataFormatString=”{0:o}”, HtmlEncode=false, and ApplyFormatInEditMode=true.
Designate the DateTime field as never participating in optimistic concurrency. See “Changing a Field’s Update Mode” earlier in this document to change the update mode for this column. Use this option carefully—removing this column from participating in optimistic concurrency will allow overwrites of the value to succeed even if the database’s value has been changed.
Two possible reasons of this issue may be that 
- the row was changed after you've retrieved it, but before calling SubmitChanges(); 
- entity properties does not correspond to rows of the table (for example, if the row is nullable in the table, but is marked as not nullable in the model).


Popular Posts