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
Biswa Pujarini MohapatraPosted Feb 11, 2014, 4:20 AM
Sasi ReddyPosted Feb 11, 2014, 12:05 AM
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 MohapatraPosted Feb 10, 2014, 7:38 AM
Jaganathan BantheswaranPosted Feb 10, 2014, 2:46 AM
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
}
Sasi ReddyPosted Feb 10, 2014, 2:24 AM
Biswa Pujarini MohapatraPosted Feb 10, 2014, 2:05 AM
Sasi ReddyPosted Feb 10, 2014, 2:04 AM
Lakshmanan Sethu SankaranarayanPosted Feb 10, 2014, 1:58 AM