Issues with Data Update in Linq
System.Data.Linq.ChangeConflictException: Row not found or changed
This exception shows up if:1. The row you are trying to update does not exist
2. If you are trying to use Attach statement without the use of TimeStamp field (this is used to keep track of current version of the record. Auto Concurrency implementation). The error message does not make at all sense in this scenario.
3. You made some minor change to the db and didnt feel like re-creating the SQL to LINQ class (DataContext) - even change in a fields attribute from Not Null to Null or vice versa. The error message does not make at all sense in this scenario.
Some good links:
http://sebastienlachance.com/2008/07/08/systemdatalinqchangeconflictexception-row-not-found-or-changed/
Good Practices for Updating in LINQ
http://borrell.parivedasolutions.com/2008/02/linq-to-sql-updating-in-aspnet-right.html
No comments:
Post a Comment