Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# LINQ的WHERE子句,其中列可以为null_C#_Mysql_Winforms_Linq_Entity Framework - Fatal编程技术网

C# LINQ的WHERE子句,其中列可以为null

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

我在使用LINQ生成WHERE子句时遇到问题。我试着用谷歌搜索它,但我只知道如果外部变量是可空整数的类型该怎么办。。。嗯,我尝试过这些方法,但我的数据集中有0…1个关系: e、 g

但我总是得到一个错误,LINQ不支持某些函数。。。有什么办法可以解决这个问题吗?

只要使用

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;