Select query with Datetime? and Datetime doesn't work!
Here what I would like to do:
var groups =
from g in Group.All()
where g.FirstDay < startDate && (g.LastDay == null || g.LastDay >= startDate)
select g;
FirstDate is a dateTime and LastDate is a nullable datetime. I'm getting an "Sys开发者_JAVA技巧tem.InvalidOperationException: The operators of the 'LessThan' do not correspond with parameters from the method 'op_LessThan'."
This query works with small modifications (and completely different results!) like:
var groups =
from g in Group.All()
where g.LastDay == null && g.FirstDay < startDate
select g;
var groups =
from g in Group.All()
where (g.LastDay >= startDate || g.LastDay == null)
select g;
I already changed the order of the expressions, but it do not change the results...
Any ideas?!
Thanks!!! I am getting crazy with this small query!
精彩评论