Click here to Skip to main content
12,500,761 members (88,908 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# LINQ
how can i use this query in Linq ---Select * from Table where NCM_SL IN(1,2)
Posted 29-Jul-10 22:04pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Try something like,

int[] serialNos= new int[] { 1, 2};
TableName.Where(p=>serialNos.Contains(p.NCM_SL))

OR

var objList = from p in TableName
              where serialNos.Contains(p.NCM_SL)
              select p;

Code is not tested so may be some minor changes will be needed.
  Permalink  
Comments
sanalpulikkal 30-Jul-10 5:18am
   
Hai Arun,
I applied this code but i got some error like this..can u help me plz...
Instance Argument:Canot convert from 'int[]' to 'System.Collctions.Generic.IEnumerable
Sandeep Mewara 30-Jul-10 5:22am
   
Comment from OP:
Hai Arun,
I applied this code but i got some error like this..can u help me plz...
Instance Argument:Canot convert from 'int[]' to 'System.Collctions.Generic.IEnumerable
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

here i am posting some thing about Linq basic operation select, insert, delete, update.


http://suhasharidas.blogspot.in/2012/08/create-linq-to-sql-connection-with.html[^]
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160919.1 | Last Updated 13 Aug 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100