You want to fill a
DataSet with parent and related child data, even if the
DataSet already has a schema that includes the relationship.
The solution shows how to load parent and child data into a
DataSet using both multiple SQL
SELECT queries and a
batch SQL query.
The solution creates a
DataSet and loads it with both schema and data from the
Sales.SalesOrderDetail tables in
DataRelation object is created relating the two tables. The first three rows from the
SalesOrderHeader table is output together with the related
SalesOrderDetail rows for each.
The C# code in Program.cs in the project
RetrieveHierarchicalDataSet is shown in Example 3-19.