Checking in my LINQ code for not true condition as below just failed:
p.IsValidLicense != trueThe row in the table had the value NULL and therefore i expected my query to return true, but in vain.
Then i executed it as SQL query in SSMS as below. Again unexpected result.
Where IsValidLicense <> 1Time for google. Seems, the NULL issue has caused lot of miseries in the lives of a lot of people. Everyone just jumped in to answer my question.
The correct way to construct the query..
In SQL:
(IsValidLicense IS NULL OR IsValidLicense = 0)In LINQ:
(p.IsValidLicense == null || p.IsValidLicense == false)Hope this helps!
No comments:
Post a Comment