Click here to Skip to main content
15,887,822 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
I am using an entity frame work in my project.
now am using

var list = from s in _db.Lists select s;


this for taking all the values from the table.
how can i get only two columns from a table.?
after that i have to take each value from the table using a foreach loop.How can i do this???
Thanks in advance
Posted
Updated 13-Dec-10 7:17am
v2

1 solution

To get only some columns you need to create a projection

var list = from s in db.Lists
           select s.column1, s.column2
 
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