0
EF LINQ query datetime - LINQ to Entities doesnât recognize the method System.DateTime ToDateTime(System.String) method
I can't get a result, what is wrong with DateTime in where clause? I would like to find for example at 26.07.2016. I get the error, see the title. Here the code: var query = from c in db.Name where DbFunctions.TruncateTime(c.Createdat) == DbFunctions.TruncateTime(Convert.ToDateTime(txtFilter.Text.Trim()).Date) select new { c.Id, c.Createdat, c.OrderNr }; gvName.Datasource = query.OrderBy(c => c.OrderNr).ToList(); In database for Createdat is in it like: 2016-07-26 19:38:19.017 Thank you
1 Answer
+ 1
Ef can't recognize Convert.toDateTime inside the linq, so use local variable and then use ef