What I really need to do is get the records into a dataset of some kind that I can work with like an array of datarows or a datatable/dataview or something. I guess I could create an array of datarows the size of "product" and then use the inner loop to add each of the product rows to that array. In my schema I don't need to worry about creating duplicate rows in the array. Any other ideas?
Main Topics
Browse All Topics





by: vbturboPosted on 2007-01-25 at 12:29:43ID: 18399052
Hi BriCrowe
dd("CustOr ders", _ tomers").C olumns("Cu stomerID") , _ ers").Colu mns("Custo merID"))
dd("OrderD etail", _ ers").Colu mns("Order ID"), _ erDetails" ).Columns( "OrderID") , False)
dd("OrderP roducts", _ ducts").Co lumns("Pro ductID"), _ erDetails" ).Columns( "ProductID "))
tomers").R ows r ID:" & custRow("CustomerID").ToSt ring())
merOrdersR elation) ng()) ring())
rDetailRel ation) erProductR elation) _ ) ring())
/en-us/lib rary/d6s95 8d6.aspx
I think this is what you are looking for
Dim customerOrdersRelation As DataRelation = _
customerOrders.Relations.A
customerOrders.Tables("Cus
customerOrders.Tables("Ord
Dim orderDetailRelation As DataRelation = _
customerOrders.Relations.A
customerOrders.Tables("Ord
customerOrders.Tables("Ord
Dim orderProductRelation As DataRelation = _
customerOrders.Relations.A
customerOrders.Tables("Pro
customerOrders.Tables("Ord
Dim custRow, orderRow, detailRow As DataRow
For Each custRow In customerOrders.Tables("Cus
Console.WriteLine("Custome
For Each orderRow In custRow.GetChildRows(custo
Console.WriteLine(" Order ID: " & orderRow("OrderID").ToStri
Console.WriteLine(vbTab & "Order Date: " & _
orderRow("OrderDate").ToSt
For Each detailRow In orderRow.GetChildRows(orde
Console.WriteLine(vbTab & " Product: " & _
detailRow.GetParentRow(ord
("ProductName").ToString()
Console.WriteLine(vbTab & " Quantity: " & _
detailRow("Quantity").ToSt
Next
Next
Next
http://msdn2.microsoft.com
vbturbo