The GetChildRows is actually called from the Parent DataTable's current DataRow object. Here is a sample:
Dim dc1 As DataColumn = _
ds.Tables("CustomerInfo").Columns("CustomerId")
Dim dc2 As DataColumn = _
ds.Tables("OrderInfo").Columns("Cust_Id")
Dim dr As New DataRelation("CustomersToOrders", dc1, dc2)
ds.Relations.Add(dr)
Dim drCustomer As DataRow
Dim drOrder As DataRow
For Each drCustomer In ds.Tables("CustomerInfo").Rows
lstDemo.Items.Add("Customer: " & _
drCustomer("CustomerId").ToString())
For Each drOrder In drCustomer.GetChildRows(dr)
lstDemo.Items.Add( _
String.Format(" Order {0} placed on {1:d}", _
drOrder("Order_ID"), drOrder("Order_Date")))
Next drOrder
Next drCustomer
>1. You don't have to relate tables.
>
>2. If you can manage all tables within one dataset, there is no need to create multile dataset as there is no benefit I see.
>
>3. You will have to call ParentTable.GetChildRows() method to get the collection of child rows.
>
>>HI,
>>I have some questions concerning the datasets usage:
>>
>>1- Does the tables added to a dataset MUST be related or can I add as many (reasonably) as I want without necessarely relate them?
>>
>>2- Is there any advantages in using more than one dataset for one connection? I mean, if I can add my tables in a single dataset, what would be the advantage in using more that one dataset?
>>
>>3- I have a Parent that is related to one of its child, will the child table be filtered automatically on the parent table row?
>>
>>Thank you for your help,
>>Christian
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi