Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Need some suggestion on, how to use NOT IN SQL function in LINQ ?
Posted
Updated 12-Mar-15 21:03pm
v2

Use CONTAINS()

e.g..

C#
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;
 
Share this answer
 
v2
The shortest answer is: NOT IN means Except[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900