Here is the query
db.setupBrands.Where(x =>
Convert.ToInt32(x.SortKey) <= id &&
Convert.ToInt32(x.SortKey) >= desID)
.Select(x => x);
Here SortKey is string type i want to convert to int. On Convert.ToInt32() i got the following error.
LINQ to Entities does not recognize the method 'Int32 ToInt32(System.String)' method, and this method cannot be translated into a store expression.
SortKey
property is always an integer, why do you have it as a string in your schema? – Jon SkeetString.Format("{0:0000}", value)
– Sergey Berezovskiy