how do I cast and int into a string? None of the following do works:
from s in ctx.Services
where s.Code.ToString().StartsWith("1")
select s
from s in ctx.Services
where Convert.ToString(s.Code).StartsWith("1")
select s
from s in ctx.Services
where ((string)s.Code).ToString().StartsWith("1")
select s
EDIT
The error I get is:
LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression
Linq to Entities does not support as many conversion of functions to server hosted sql.
ToString (on anything) is one of them
Here's the list of supported functions
This has been asked before on Stack overflow specifically asking how to convert an int to a string