Linq Update Query generates Where 0 = 1?

后端 未结 1 371
南笙
南笙 2021-01-07 23:49

I am setting the Address of a class generated by Linq 2 Sql and when I try to SubmitChanges(), the sql query it generates is:

Update Users
Set Address = @po
         


        
相关标签:
1条回答
  • 2021-01-08 00:18

    This can happen when your object model differs from the database even by one property.

    Is it possible that Address is nullable in the database and not in your model, or the other way around? Or the type differs, say ntext vs nvarchar, etc? In some cases it can be another unrelated property...think back to the last change to the database or model you made, make sure that's in sync.

    0 讨论(0)
提交回复
热议问题