Article ID: 309487 - Last Review: September 4, 2003 - Revision: 3.1 HOW TO: Read Hierarchical Data into a DataSet in Visual Basic .NETThis article was previously published under Q309487 On This PageSUMMARY Use this step-by-step guide to copy hierarchical data into
a DataSet by using the Fill method of the DataSet class. How to Read Hierarchical Data into a DataSetYou can use hierarchical rowsets or chapters (OLE DB type DBTYPE_HCHAPTER and ADO type adChapter) to fill the contents of a DataSet. When the DataAdapter finds a chaptered column during a Fill operation, a DataTable is created for the chaptered column, and that table is filled with the columns and rows from the chapter. The name of the table created for the chaptered column takes its name from both the parent table name and the chaptered column name; it has the following syntax:
ParentTableNameChapteredColumnName
If a table already exists in the DataSet and its name matches the name of the chaptered column, the
current table is filled with the chapter data. If there is no column in an
existing table that matches a column found in the chapter, a new column is
added.When the Fill operation is completed, the DataSet will contain two tables: Customers and CustomersOrders. The CustomersOrders table represents the chaptered column. An additional column named Orders is added to the Customers table, and an additional column named CustomersOrders is added to the CustomersOrders table. The Orders column in the Customers table is set to auto-increment. A DataRelation, CustomersOrders, is created by using the columns that were added to the tables with Customers as the parent table. The following sample code uses the Customers and Orders tables that are included in the Microsoft SQL Server Northwind database.
REFERENCES For additional information about a similar topic in Visual
Basic 6.0, click the following article number to view the article in the
Microsoft Knowledge Base: 189657
(http://support.microsoft.com/kb/189657/EN-US/
)
HOWTO: Use the ADO SHAPE Command
For more information about ADO.NET objects and
syntax, refer to the following topic in the Microsoft .NET Framework Software
Development Kit (SDK) documentation:
Retrieving Data Using DataReader http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpcontheadonetdatareader.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpcontheadonetdatareader.asp) | Article Translations
|
Back to the top
