c# - LINQ issue with Equals statement -
i'm getting error following:
var answerlist = (from answer in db.questionanswers answer.tloginid.equals(tid) && answer.ploginid.equals(pid) && answer.submitted.equals(submittedval) select answer).tolist();
the error is:
unable create constant value of type 'system.object'. primitive types or enumeration types supported in context.
however, when change to:
var answerlist = (from answer in db.questionanswers answer.tloginid.equals(tid) && answer.ploginid.equals(pid) select answer).tolist();
then this:
answerlist.where(x => x.submitted.equals(submittedval));
it works... missing? me these statements doing same thing. i'm not sure why working this.
update:
i figured out after looking @ link @sergeylitvinov provided .equals
column checking submitted
boolean
instead of integer
once made types same statements worked. although did change .equals
==
.
the error linq entities query provider attempting transform query expression sql statement. second example enumerates linq entities query prior testing submitted.equals(submittedval)
, mean you're using standard linq objects in local memory (i.e. not converted sql).
Comments
Post a Comment