Wednesday, April 15, 2009

Row not found or changed - System.Data.Linq.ChangeConflictException

Have you received a System.Data.Linq.Changeconflictexception with the message ‘Row not found or changed.’ when updating rows with LINQ to SQL. It happened to me a while ago at my customer and we could not get why we received that message. It worked the day before and suddenly this message appear. But after some research we figure it out that it was a SQL script that changed the nocount to on in the database server. And LINQ need the nocount to be off. So after changing it back to off it works again.

1 comment:

  1. This post is great Hans, but for someone, if It did't resolve your problem, check this: http://devspeak.com/b/3-tips-to-fix-row-not-found-or-changed-linq-to-sql/
    It explains that we need to keep an eye in DateTime columns, check for different data types between the dbml and your database, and lastly, explains the LinQ optimistic concurrency approach.

    ReplyDelete