Watch this example on YouTube:
An exception of type 'System.NotSupportedException' occurred in System.Data.Entity.dll but was not handled in user code
Additional information: LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression.
this line is causing this error:
emp = emp.Where(s => s.HireDate.ToString().Trim().Equals("1/1/2015"));
to fix it replace
var emp = from s in db.Employees
select s;
with
var rawData = (from s in db.Employees
select s).ToList();
var emp = from s in rawData
select s;
No comments:
Post a Comment