IS IT POSSIBLE TO USE INNER JOIN QUERY IN A DATASET

Scenario: U have 2 tables in ur dataset with both the table contains a column name 'Samecolumn'
Table1: Samecolumn has the following 3 value
col1
col2
col3
Table2: Samecolumn has the following 2 value
col2
col3
Is it possible to query in the dataset to get the ouput of 2 rows i.e) col2, col3

Solution: No, There is no direct way to get the child rows
DataRelation and get joined rows, you will need to use the GetChildRows method of DataRow and pass the DataRelation object.
The following code example creates a DataRelation between the Customers
table and the Orders table of a DataSet and returns all the orders for each
customer.

Dim custOrderRel As DataRelation = custDataset.Relations.Add("CustOrders", _
custDS.Tables("Table1").Columns("Samecolumn"), _
custDS.Tables("Table2").Columns("Samecolumn"))

Dim custRow As DataRow
Dim orderRow As DataRow

For Each custRow in custDataset.Tables("Table1").Rows
Console.WriteLine(custRow("Samecolumn"))
For Each orderRow in custRow.GetChildRows(custOrderRel)
Console.WriteLine(orderRow("Samecolumn"))
Next
Next

0 comments:

Listen to nirmaln - sakara - playlist audio songs at MusicMazaa.com