documenttype customerId
1 ............
2 ...............
3 ..............
I have to retrieve documenttype values based on customerId using linq.how to do that?.
List basicdetails = (from records in db.NCBAccountDocuments
where records.CustomerReferenceNo == CustomerId
select records).ToList();
I done like that ,but it is retrieving all column values.I need only one column value .please help me 
Lakshmanan Sethu SankaranarayanRank #124 · 17.7K reputationPosted Feb 9, 2014, 8:58 PM EST
Sasi ReddyRank #4,458 · 342 reputationPosted Feb 9, 2014, 9:04 PM EST
Biswa Pujarini MohapatraRank #465 · 5.4K reputationPosted Feb 9, 2014, 9:05 PM EST
Sasi ReddyRank #4,458 · 342 reputationPosted Feb 9, 2014, 9:24 PM EST
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Feb 9, 2014, 9:46 PM EST
var basicdetails = (from records in db.NCBAccountDocuments
where records.CustomerReferenceNo == CustomerId
select new {
DocType = records.documenttype
}).ToList();
Then access it like,
foreach(var detail in basicdetails)
{
// detail.DocType
}
Biswa Pujarini MohapatraRank #465 · 5.4K reputationPosted Feb 10, 2014, 2:38 AM EST
Sasi ReddyRank #4,458 · 342 reputationPosted Feb 10, 2014, 7:05 PM EST
I tried as per Jaganathan ,but my requirement is basicdetails should be as List
var basicdetails = (from records in db.NCBAccountDocuments
where records.CustomerReferenceNo == CustomerId
select new {
DocType = records.documenttype
}).ToList();
Instead of Var datatype,i need List
Biswa Pujarini MohapatraRank #465 · 5.4K reputationPosted Feb 10, 2014, 11:20 PM EST