I have an SQL Server table Employee
with a column EntryDate
defined as DATETIME
.
I also have the following poco:
public class Employee
{
public int Id {get; set;}
public DateTime EntryDate {get; set;}
...
}
When I query the table using:
Db.Select<Employee>(e => e.EntryDate >= new DateTime(2014, 8, 15));
Or:
Db.Select<Employee>(q => q.Where(e => e.EntryDate >= new DateTime(2014, 8, 15)));
I get what I expect, however when I try to run:
Db.Select<Employee>(e => e.EntryDate.Date >= new DateTime(2014, 8, 15).Date));
Or:
Db.Select<Employee>(q => q.Where(e => e.EntryDate.Date >= new DateTime(2014, 8, 15).Date));
I get:
variable 'e' of type 'Employee' referenced from scope '', but it is not defined
Just to confirm, writing raw SQL also works fine.
Any ideas?
.equals()
as that's the first thing I tried which gives me the same error – Iong