Reputation: 1177
Every post I have found suggests that this happens when there is a null
value. I have tried examples such as one found here but no matter what I seem to try I still end up with the same error message.
Does anyone have any idea of what the case could be?
var aaresults1 = (from a in db.AAs
where a.AAID == aaid.AAID & a != null
select a);
Upvotes: 2
Views: 150
Reputation: 156624
Reading through other StackOverflow posts about this error, it appears to happen when a where
clause refers to a value that is null. Based on that, I'm guessing that your aaid
object is null when you run this.
var aaresults1 = db.AAs.AsQueryable();
if(aaid != null)
{
aaresults1 = aaresults1.Where(a => a.AAID == aaid.AAID);
}
Upvotes: 4