Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.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
Asp.net mvc 正在尝试将sql转换为linq sql_Asp.net Mvc_Linq_Sql To Linq Conversion - Fatal编程技术网

Asp.net mvc 正在尝试将sql转换为linq sql

Asp.net mvc 正在尝试将sql转换为linq sql,asp.net-mvc,linq,sql-to-linq-conversion,Asp.net Mvc,Linq,Sql To Linq Conversion,我正在尝试将此SQL代码转换为linq SQL。但我不明白即使是医生。。。有人能帮我吗 select prcleunique, LibelleProjet, from projet a where eqcleunique in (select EqCleunique from Compo where uscleunique = '{0}') and (a.socleunique in (select socleunique from utilisat where uscleunique = '

我正在尝试将此SQL代码转换为linq SQL。但我不明白即使是医生。。。有人能帮我吗

select prcleunique, LibelleProjet, from projet a
where eqcleunique in (select EqCleunique from Compo where uscleunique = '{0}') 
and (a.socleunique in (select socleunique from utilisat where uscleunique = '{0}') or a.socleunique is null) 
and a.archive = 2 order by LibelleProjet", idUtilisateur);

这些嵌套的sql查询可以在Linq中很好地分解。每次选择时,都有一个单独的linq查询:

var clause1 = from row in _db.Compo where uscleunique == '{0}' select EqCleunique;
然后使用最后一个查询中的子句

var result = from row in _db.project where clause1.Contains(row.eqcleunique) select row.whatever;

我希望这个示例足以让您开始学习。

这些嵌套的sql查询可以在Linq中很好地分解。每次选择时,都有一个单独的linq查询:

var clause1 = from row in _db.Compo where uscleunique == '{0}' select EqCleunique;
然后使用最后一个查询中的子句

var result = from row in _db.project where clause1.Contains(row.eqcleunique) select row.whatever;
我希望这个例子足以让你开始。

也许我的可以指导你。也许我的可以指导你。