开发者

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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜