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

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -