I checked online for some answers, and I understood that I cannot translate ToInt32 to T-SQL, and I need to use run my query in-memory first and then do the conversion, but I don't know how to apply it in my example. I have the query below, and it shows me the error message written in the title:
string[] parts = rvm.ZipCode.Split('-');
var list = results.OrderBy(b =>
Math.Abs(Convert.ToInt32(parts[0]) - Convert.ToInt32(b.Zip))).Take(5).ToList();
Where results
is another query that I applied earlier. Any idea how to solve it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…