C# LINQ的WHERE子句,其中列可以为null
我在使用LINQ生成WHERE子句时遇到问题。我试着用谷歌搜索它,但我只知道如果外部变量是可空整数的类型该怎么办。。。嗯,我尝试过这些方法,但我的数据集中有0…1个关系: e、 g 或 但我总是得到一个错误,LINQ不支持某些函数。。。有什么办法可以解决这个问题吗?只要使用C# LINQ的WHERE子句,其中列可以为null,c#,mysql,winforms,linq,entity-framework,C#,Mysql,Winforms,Linq,Entity Framework,我在使用LINQ生成WHERE子句时遇到问题。我试着用谷歌搜索它,但我只知道如果外部变量是可空整数的类型该怎么办。。。嗯,我尝试过这些方法,但我的数据集中有0…1个关系: e、 g 或 但我总是得到一个错误,LINQ不支持某些函数。。。有什么办法可以解决这个问题吗?只要使用 where x.question_id != null && x.question_id == oldId 因此,您的查询应该是: IEnumerable<possible_answer> po
where x.question_id != null && x.question_id == oldId
因此,您的查询应该是:
IEnumerable<possible_answer> possibleAnswersQuery =
from x in Mentor11Entities.possible_answers
where x.question_id != null && x.question_id == oldId
select x;
只用
where x.question_id != null && x.question_id == oldId
因此,您的查询应该是:
IEnumerable<possible_answer> possibleAnswersQuery =
from x in Mentor11Entities.possible_answers
where x.question_id != null && x.question_id == oldId
select x;