Dim ds As New DataSet() Dim strSQL As String = "SELECT Cust_ID, Order_Id, “ & _ “Order_Date FROM Orders WHERE Year(Order_Date) > 1997" Dim oda As New OleDbDataAdapter(strSQL, connStr) oda.Fill(ds, "OrderInfo") strSQL = "SELECT CustomerID FROM Customers “ & _ “ORDER BY CustomerID" Dim sda As New SqlDataAdapter(strSQL, connStr) sda.Fill(ds, "CustomerInfo") 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()) ' Iterate through related rows. 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>Hi All,
>myDS.Relations.Add("MemSub", myDS.Tables("Member").Columns("MemberID"), myDS.Tables("Subs").Columns("MemberID")) >>how to read the feilds from the datarelation, or how to create the datarow from the datarelation "MemSubs" to read the "subs" colums ?