本文介绍了使用foreach从表中获取每个值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在项目中使用实体框架. 现在正在使用
I am using an entity frame work in my project. now am using
var list = from s in _db.Lists select s;用于从表中获取所有值. 我怎样才能从表中只获得两列? 之后,我必须使用foreach循环从表中获取每个值.我该怎么办呢? 在此先感谢
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
推荐答案要只获取一些列,您需要创建一个投影 To get only some columns you need to create a projection var list = from s in db.Lists select s.column1, s.column2
更多推荐
使用foreach从表中获取每个值.
发布评论