Reputation: 311
I have a query like this :
var q2 = from i in dbconnect.tblComplementContracts
join b in dbconnect.tblContracts on i.contractId equals b.contractId
where (i.complementDate.Value - GetTime()).TotalDays <= _permission
select i;
I want to access both of "i" and "b" fields,For example i tried "select i,b" but it didn't work what should i do ?
Thanks
Upvotes: 0
Views: 72
Reputation: 460278
You can use an anonymous type:
var q2 = from i in dbconnect.tblComplementContracts
join b in dbconnect.tblContracts on i.contractId equals b.contractId
where (i.complementDate.Value - GetTime()).TotalDays <= _permission
select new { I = i, B = b};
foreach (var x in query)
{
Console.WriteLine("complementDate:{0} contractId:{1}",
x.I.complementDate, x.B.contractId);
}
Upvotes: 4