MDAC 2.5 SDK - OLE DB Providers
Data Shaping Service for OLE DB


 

Accessing a Child Rowset

See Also                    Related Topics

ADO Technique

When two Recordsets are related, an index is created on the related fields in the child Recordset and a field is added to the Fields collection of the parent Recordset, which has a reference to the child Recordset in the Value property.

To access the child Recordset, you can make a reference to the child Recordset in an empty Recordset object, in effect loading the child Recordset into another. ADO exposes the child field as type adChapter. You can write generic code to handle fields that appear as child Recordsets without having to know the field name ahead of time, as shown in this example:

Dim rChapter As ADODB.Recordset
rst.Open 
   "SHAPE {select * from customer} 
      APPEND ( {select * from " & _
               "custOrder} AS chapter RELATE cust_id TO cust_id)", cnn
rChapter = rst("chapter")
debug.print rChapter.fields(0)

OLE DB Technique

For more information about accessing a child rowset, see "Navigating Hierarchical Rowsets" in the "Hierarchical Rowsets" topic of Chapter 4, "Rowsets."