Row not found or changed LINQ C# error on simple statement

后端 未结 4 767
执念已碎
执念已碎 2021-02-01 20:14

First of all, there is no chance that this is a multi-user issue, as I\'m working locally on a dev version of the database.

I am getting the not very explanatory R

4条回答
  •  难免孤独
    2021-02-01 20:51

    Looking at the SQL Profiler output, it helped me figure out the answer to this. There was a bad piece of SQL being generated which ended with WHERE 0 = 1 ... an obvious error.

    It turns out that the field had simply been changed to allow nulls by another developer, and the Linq-to-SQL file hadn't been updated accordingly.

    In short, if the Row not found or changed error message appears to be generated for no reason, make sure your database schema exactly matches your .dbml file else you'll get this error message on any fields that have slightly differing schemas.

提交回复
热议问题