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 Where 0 = 1 <a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="133e3e53637c">[email protected]</a>: Input VarChar (Size = 15; Prec = 0; Scale = 0) [123 45th Street]
I can’t figure out why I am getting Where 0 = 1.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0