In Table, DueDate data type is varchar. Now I want to check the due date with today\'s date
var query = (from o in db.Order_Reports
where Convert.
I don't know a way to implement it as you describe it, because
However, there are some possible workarounds
(code)
// Our required date
DateTime reportDate = new DateTime(2014,1,1).Date;
// Let's find number of days between now and required day. Ensure that the date is not in the future!
int deltaDays = (DateTime.Now.Date - date).Days;
// Let's get the list of dates which we need the reports for
var dates = Enumerable.Range(0, deltaDays + 1).Select(dd => DateTime.Now.Date.AddDays(-dd).ToString("MM/dd/yyyy")).ToArray();
// and query by this list
var query = (from o in db.Order_Reports
where o.ReportDueDateTime in dates
select o);
This will be a little inefficient, but achieve the purpose without changing the DB. Treat it as temporary solution.