I have an application with VB.Net and I am using a dataset with two data tables. i made relation between the two tables and navigate through data. I navigate from one one record to on other. But i want also to use the relation between the tables in the dataset and also get the records from the other table. is there any way to do this? the following code shows how i display data:
sql = "select * from COMPUTER"
da = New SqlDataAdapter(sql, sqlConn)
da.Fill(dsPC, "pcTable")
sql = "select * from COMPUTER_BRAND"
da = New SqlDataAdapter(sql, sqlConn)
da.Fill(dsPC, "pcBrand")
pcLocation = New DataRelation("pcLocation",
dsPC.Tables("pcTable").Columns(0),
dsPC.Tables("pcLocation").Columns(1))
dsPC.Relations.Add(pcLocation)
now, how to navigate between the records in the data tables?
You have to use the GetChildRows method.
Example: