Linq Select in

  • Thread starter Thread starter Robert Bravery
  • Start date Start date
R

Robert Bravery

Hi all,

Using studio 2008
Vista
MSSQL 2005

I am wanting to achive something like:
select * from mytable where mycolumn in (1,2,3)

How does one perform a select in, with linq

Thanks
Robert
 
Robert Bravery said:
Using studio 2008
Vista
MSSQL 2005

I am wanting to achive something like:
select * from mytable where mycolumn in (1,2,3)

How does one perform a select in, with linq

Try Contains:

int[] options = {1, 2, 3};

var query = from row in mytable
where options.Contains(row.MyColumn)
select row;
 
Thanks jon, that helped a lot. It worked

Robert

Jon Skeet said:
Robert Bravery said:
Using studio 2008
Vista
MSSQL 2005

I am wanting to achive something like:
select * from mytable where mycolumn in (1,2,3)

How does one perform a select in, with linq

Try Contains:

int[] options = {1, 2, 3};

var query = from row in mytable
where options.Contains(row.MyColumn)
select row;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top