come faccio a trasmettere e int in una stringa? Nessuno dei seguenti fare lavori:Linq int alla stringa
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
L'errore che ottengo è:
LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression
I primi due dovrebbero funzionare ... puoi approfondire cosa significa "nessuno dei seguenti ... lavori"? –
Non stai ottenendo alcun risultato? Hai confermato che la colonna "Codice" contiene un valore che inizia con un "1"? – Keith
www.linqpad.net è ottimo per l'apprendimento di Linq (e praticamente di qualsiasi altra cosa in .NET). È gratuito e altamente raccomandato. Inoltre, la sua Intellisense da $ 19 è ottima. –