Home All Groups Group Topic Archive Search About
Author
19 Apr 2006 4:22 PM
Aziz
Take this XML Schema
http://img81.imageshack.us/img81/3697/datasetscreen11lb.jpg

In this system an AlloyCode is made from several BaseMetalCodes (but
not the same combination of BaseMetalCodes for every AlloyCode)

BaseMetalStocks (Parent)
BaseMetalAlloy (Child)

If I wanted to get all related rows from the parent table when the
value of the Alloycode(PK) is a certain AlloyCode (e.g. HF-342) I would
do something like this:

        For Each rowAlloys In dsDataset.BaseMetalAlloy.Rows
            Debug.WriteLine(rowStocks("AlloyCode"))

            For Each rowAlloys In
rowStocks.GetParentRows("BaseMetalStocks_BaseMetalAlloy")
                Debug.WriteLine(rowAlloys("BaseMetalCode"))
                Debug.WriteLine(rowAlloys("BaseCostPerGram"))

            Next
       Next

But how do I store this data in my program? (Say I wanted to work out
the price of an alloy which had different proportions of  BaseMetal in
it from the BaseCostPerGram). What's the best way to do this, keeping
in mind, that some AlloyCodes will be made from 2 BaseMetalCodes, some
from 3, some 4.

Would a DataTable with a Primary Key work? (that way I could hold all
the BaseMetalCodes belonging to a specific AlloyCode in a temporary
table). What's the syntax to add data from a datarelation to a
datatable.

AddThis Social Bookmark Button