MDAC 2.5 SDK - Technical Articles


 

Parameterized Command Hierarchy

A parameterized hierarchy is similar to a relation-based hierarchy. The main difference is that instead of downloading all the records for both the parent and the child recordsets, the parents are downloaded and then the child records are downloaded as they are accessed by the consumer application. This has the benefit of a shorter initial query time, but the application must be connected to the server for new child records to be accessed.

The following example is a variation on the relation-based hierarchy example, and it generates the same results as that example's first SHAPE command. (There is a possible exception: Because the expression handling code in the Data Shaping Service for OLE DB is different than that in the server, there could be cases where the two commands might generate different results. This could be especially noticeable with relations involving Null values.) However, instead of getting all of the data for the orders recordset up front, it fetches data for the orders recordset only when the application attempts to look at any of the orders.

Note   The ADO documentation expands on the examples given here as well as describing the full grammar.

SHAPE  {select * from customers}
APPEND ({select * from orders where customerid = ?} AS rsOrders
RELATE customerid TO PARAMETER 0)