Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LINQ query - null date

Tags:

linq

Ive a simple linq query to return records with a null date field, just want to check the synatx of the "where" line is ok

var query2 = from cs in db.tblCases where cs.date_closed == null etc, etc,

thanks again

DD

like image 381
DarkW1nter Avatar asked Aug 31 '26 17:08

DarkW1nter


1 Answers

I would be careful with using null, I have seen issues with linq not generating the correct sytnax (ex IS NULL vs ==null)

I would recommend

var query2 = from cs in db.tblCases where !cs.date_closed.HasValue etc, etc,

like image 91
Nix Avatar answered Sep 05 '26 04:09

Nix



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!