Obtaining One Child Table Using Dataset

H

hadi

Hi All,

I am a beginner in ADO.NET . Here is my scenario. I have a
Customers->Orders->Order Details relationship defined using XSD Designer.
Now i would like to automatically detect only ONE child table of a root
table.

Suppose now i loaded Customers table. Based on the defined relationship in
DataSet, then it will automatically detect based on Foreign Key Relationship
that the child table of the Customers' table is Orders table. The same thing
applied to Orders table.

Could you all please give me some clue about this matter?

Thank you very much for your help

hadi
 
C

Calvin Luttrell/ProjectThunder.com

Hadi,

I'm not quite sure what you are tyring to accomplish by diong this. So maybe I'm not getting you but here it goes. The dataset will contain a property called Relations with the relationships defined. You could also look at a table like Customers and the property called ParentRelations and ChildRelations. In those objects you'll find all the relationship information. Hope this helps. Good Luck!

-Calvin Luttrell
ProjectThunder.com
 
W

William Ryan eMVP

Hadi:

The dataset has a relations collection that you can use. I'm not sure if
you are trying to find the corresponding child records or merely the name of
the table. In a typed dataset scenario, this becomes less valuable (being
able to detect it programatically) b/c you know in advance what the
relations are. I'm lost though about the 'only one' requirement. What if
multiple tables are defined w/ relations, what criteria do you want to use
to determine which on is the 'only' one?

If you can hash out the objective a bit more, I can be of more assistance.

HTH,

Bill

--
W.G. Ryan MVP Windows - Embedded

http://forums.devbuzz.com
http://www.knowdotnet.com/dataaccess.html
http://www.msmvps.com/williamryan/
 
H

hadi

Hi All,

Thank you very much for all your response. I really feel happy cause I can
get someone to 'shed' a light for a path.

Actually I am just looking for the child table name only. So using
ds.Relations.ChildTable.TableName is enough for me to accomplish the goal.
For all your reference, I need to "read" from a XSD file and "infer" all the
relationships from there.

Thank you William and Calvin for all your response. Really appreciate that .

Regards,

hadi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top