I’ve got a table that caches calculated values for certain dates. I want to use LINQ to select all rows where the calculated value fields are null.
But when I use isNothing I get an error that LINQ can’t translate this into T-SQL. Is there a way to select null values with link, like this…?
Dim var = From rec As Record In myDataContext.Records Where IsNothing(rec.calculatedValue) Select rec
Other posts on stackoverflow mostly discuss how to avoid or check for null values with LINQ.
Note: I can’t just set cacluatedValue’s default to -1 to flag records whose calculated value has not been set (and then select those records) because I run queries that sum/average the calculated values. Selecting nulls seems cleaner and less bug-prone.
1 Answer