LINQ - i want to retrive tha data from two table

Asked By mohd ghouse on 04-Jan-12 08:34 AM
var qry = from c in drop.tblStudentDetails  join s in drop.tblStudentAddresses on   c.AddressId   equals s.Id select new { c.Id, s.Address };

for one table i have return it but i want to retrive one details fro another table
Riley K replied to mohd ghouse on 04-Jan-12 08:41 AM


In this codition  { c.Id, s.Address }; you are already selecting data from Two tables

what else you need??
[)ia6l0 iii replied to mohd ghouse on 04-Jan-12 09:30 AM
You seem to be using the right tables. But not quite sure what is it that you seem to be missing. 

And Instead of Join, you could do this:
var qry = 
from c in drop.tblStudentDetails
from s in drop.tblStudentAddresses
where(c.AddressId   equals s.Id)
select new { c.Id, s.Address };

I also believe that you are joining on the wrong fields (adressid and student id?). 
mohd ghouse replied to [)ia6l0 iii on 04-Jan-12 10:44 AM
sir this was the one query that i have join but in that same  table i wanna to joinone more table that in my table i haver one column as studentid in one table and in another table student name is there that i wanna to retrive...........
[)ia6l0 iii replied to mohd ghouse on 04-Jan-12 10:59 AM
Please explain some more.