i wana convert string to int in linq for objects, but Convert.ToInt32 and int.Parse cannot translate to sql And my BIG database and cannot get all of them in memory (more than 60 thousand records and get more) my request looks like
int myNumber = 1390;
var result = from dr in myEntitiy.TableX
where (Convert.ToInt32(dr.stringYear) > myNumber)
select dr;
error say cannot translate the conversion method
LINQ to Entities does not recognize the 'Int32 ToInt32 (System.String)' method, and this method cannot be translated into a storage expression.
what's the solution
UPDATE: If there is no way to do this, please let me know about it, then I need to change the type of the field in the database, but it will be difficult :(
source
share