I'm trying to do a join on two tables based on multiple conditions, the problem is I'm not able to compare the date fields. The date is stored in datetime format in DB and I want all the records on a particular date, when I do this in as shown in the code below, I get this exception .. Method 'System.String ToShortDateString()' has no supported translation to SQL.
P.S this is part of a big query..
string dt = "10/14/2009";
using (ReportGeneratorDataContext db = new ReportGeneratorDataContext())
{
var r = from f in db.f
join a in db.a
on new { x = f.ID, y = f.date.ToShortDateString() } equals new { x = a.ID, y = dt }
select f.Name;
}
Any workarounds?