I have a table with records that has 5 fields. how can i get all the values of just one field using linq statment.
Thank you in advance
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Yadlapalli SrikanthPosted Sep 17, 2015, 5:14 AM
class ProjectInfo
{
public string Name {get; set; }
}
public List GetProjectForCombo()
{
using (MyDataContext db = new MyDataContext (DBHelper.GetConnectionString()))
{
var query = from pro in db.Projects
select new ProjectInfo(){ Name = pro.ProjectName};
return query.ToList();
}
}