Linq to sql to get the records from parent-child tables?

You don't have to do anything special. Relations are loaded automatically. If you want to iterate over all child objects of a parent object you can do it like so: var parent = objectContext.Parents.First(); foreach(var child in parent.

Children) { ... }.

Yes, You are right! Thanks – Yogesh Dec 15 '10 at 12:12.

I have 2 tables (say parent and child table and 1 to many relation), I drag and droped these tables on . DBML (linq to sql classes). Now in the code, I would be able to see the relation in classes as association.

Parent class has list of child objects. My question is can I write a linQ statement to featch a (single) record from parent table and all related records from child table and bind to an object.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions