Click here to Skip to main content
15,896,318 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to use sql quary in linq

SQL
select * from AcoTransaction where AcoTransactionTypeId IN (8,11,18,26,1,14,17,25,27,30,5,6,7,20,21,22,12,13,19,24)


in linq the quary is not working

XML
acoTransaction = (DcAccountOperation.GetTable<AcoTransaction>()).Where(
                        p => (p.AcoTransactionTypeId in(8,11,18,26,1,14,17,25,27,30,5,6,7,20,21,22,12,13,19,24)).ToList();
Posted
Updated 23-Apr-14 9:02am
v4

 
Share this answer
 
IN operator can be achieved by using 'Contains'
Sample below
XML
List<int> input = new List<int>() { 8, 11, 18, 26, 1, 14, 17, 25, 27, 30, 5, 6, 7, 20, 21, 22, 12, 13, 19, 24 };

List<int> source = new List<int>() { 8, 11, 18, 26, 1, 14, 17, 25, 27, 30, 5, 6, 7, 20, 21, 22, 12, 13, 19, 24 };

 var acoTransaction = source.Where(p => input.Contains(p) ).ToList();
 
Share this answer
 

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



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