Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression


I'm using the following code :

C#
using(var sd=new dataEntities())
{
var listofdata=sd.users.where(d=>d.id.ToString().Contain("2"));// id as int
// error : LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression.
}
Posted
Updated 10-Oct-12 6:39am
v2

1 solution

answer : var listofdata=sd.users.where(d=>SqlFunctions.StringConvert((double?)d.id).Contain("2"));
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900