开发者

Dynamic Linq to Entities...querying date fields

开发者 https://www.devze.com 2022-12-22 10:58 出处:网络
I am trying to use Linq to Entities with the Linq.Dynamic library (via Scott Guthrie) and I\'m having some strange issues with querying dates.

I am trying to use Linq to Entities with the Linq.Dynamic library (via Scott Guthrie) and I'm having some strange issues with querying dates.

var _date1 = DateTime.Now.AddDays(30).Date;
var _date2 = DateTime.Now.AddDays(31).Date;
var dateField = "DUEDATE";

docs = db.DOCUMENT.Where("@0 >= @1", dateField, _date1).Where("@0 <= @1", dateField, _date2);

This return no results, when it definitely should... 开发者_运维技巧it's simply a between statement to grab records for the specified day, but LinqToEntities doesn't like the combo. Any ideas??

0

精彩评论

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