score:13

Accepted answer

Just do the conversion outside the query, so you compare the results directly to a variable of type long:

// TODO: Error handling
long projID = Convert.ToInt64(ProjectFileID.ToString());

var d = (from f in context.FileInfo
         where f.ID == projID
         select (f));

Also, given that you're calling ToString() on ProjectFileID, can you maybe just cast it instead, since it certainly seems like it's an int or something along those lines.

score:0

The reason is that it tries to do the conversion inside the query itself and the behind the scenes SQL has no definition for that Extension. The workaround is doing the conversion to long outside of the query (to a temp variable) and passing that in to the LINQ.


Related Query

More Query from same tag