You can in a way group tables like sql, but you have to setup the dataset to handle it for you. There are two ways i know of, and only one i use, XML Schema's.
But, are you getting the data from sql or simular database? if so, then its not really going to work.
Add a xml schema file to your project, when its open, you can drag/drop the tables you want and type in the columns.
Now, when you have finished, drag a child table to an parent one: Products(Child) -Into> Categories(parent). Save the file (you may need to copy it into the Bin folder)
In your code, where you have your dataset decliration, use:
ds.ReadXMLSchema(XMLSchema_FileName)
to load the schema
Then when you add a product(example), you ref the category:
Dim NewProductRow as DataRow = DataSet.Tables("Products").NewRow
NewProductRow.SetParentRow(CategoryRow)
...
Then when you want all products under 'Toys' you:
Dim ToyProducts() As DataRow = DataSet.Table("Categories").Select("Name = 'Toys')(0).GetChildRows("Categories_Products")
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.