views:

56

answers:

0

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??