使用“不在”Linq? [英] Use “ NOT IN” Linq ?
本文介绍了使用“不在”Linq?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
需要一些建议,如何在LINQ中使用NOT IN SQL函数?
Need some suggestion on, how to use NOT IN SQL function in LINQ ?
推荐答案
Google it。
http://stackoverflow.com/questions/183791/how-would-你不要在查询中使用linq [ ^ ]
Google it.
http://stackoverflow.com/questions/183791/how-would-you-do-a-not-in-query-with-linq[^]
使用CONTAINS()
例如。
UseCONTAINS()
e.g..
SqlQry= Select * from table_name where column_Name not in(val1,val2,val3,..)
List<string> liS=new List<string>;
liS.add(val1);
liS.add(val2);
.
.
.
LinqQuery:from o in context.table_name where !liS.Contains(column_Name) select o;
最短的答案是: NOT IN
表示除了 [ ^ ]。
The shortest answer is: NOT IN
means Except[^].
这篇关于使用“不在”Linq?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文