Hierarchical Cursors and Data Shaping Summary

See Also   

ADO 2.0 introduces the Hierarchical Cursor feature, which enables you to define a child Recordset object as the value of a field in a parent Recordset.

Here is a useful way to envision Hierarchical Cursors. Imagine a visual control, such as the File Open dialog, that shows files and subdirectories in a hierarchical fashion. Think of each directory as a Recordset object; each file within a directory as a Field object; and each subdirectory within a directory as a Field object whose value is another Recordset.

ADO 2.0 also introduces a new Shape data manipulation language syntax, which allows you to make queries that result in a hierarchical Recordset. A Shape language command is issued just as you would issue any ADO command string.

The Shape language is built into the ADO Client Cursor Engine. We will call the process of creating it Data Shaping.

The Shape language enables you to make hierarchical Recordset objects in two ways. The first appends a child Recordset to the parent Recordset, while the second computes an aggregate operation on a child Recordset and generates a parent Recordset.

You can nest hierarchical Recordset objects to any depth you require (that is, create children Recordset objects of children Recordset objects, and so on).

You can access the resulting hierarchical Recordset programmatically or through an appropriate visual control.

The Shape language is relatively difficult to write. Therefore, Microsoft provides a visual tool that generates Shape commands for you (see the Visual Basic topic, "The Data Environment Designer") and another visual tool that displays hierarchical cursors (see the Visual Basic topic, "Using the Microsoft Hierarchical Flexgrid Control").