LINQ Dynamic query nullable field

asp.net dynamic-linq vb.net

Question

Suppose an SQL table 'employees' (containing a nullable datetime field called 'endDate')

static LINQ:

dim  result = db.employees.where(function(c) not(c.endDate.hasValue))

Works perfectly!

dynamic LINQ:

dim  result = db.employees.where("it.endDate == null") 

Throws an error

Operator '=' incompatible with operand types 'DateTime?' and 'Boolean'

Now I am completely blocked in my project because of this issue. Any of you already faced this problem ?

Thanks a lot in advance - zSkk

1
2
8/1/2012 10:27:13 AM

Popular Answer

there is nothing like ==(double equal) in SQL , use =(single equal) if you want to compare.

2
8/2/2012 7:29:17 AM


Related Questions





Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow