Visual Basic: RDO Data Control

rdoResultsets Collection

See Also    Example    Properties    Methods    Events

The rdoResultsets collection contains all open rdoResultset objects in an rdoConnection.




Remarks

A new rdoResultset is automatically added to the rdoResultsets collection when you open the object, and it's automatically removed when you close it. Several rdoResultset objects might be active at any one time.

Use the Close method to remove an rdoResultset object from the rdoResultsets collection, disassociate it from its connection, and free all associated resources. No events are fired when you use the Close method.

Setting the ActiveConnection property to Nothing removes the rdoResultset object from the rdoResultsets collection and fires events, but does not deallocate the object resources. Setting the rdoResultset object's ActiveConnection property to a valid rdoConnection object causes the rdoResultset object to be re-appended to the rdoResultsets collection.

Note   RDO 1.0 collections behave differently than Data Access Object (DAO) collections. When you Set a variable containing a reference to a RDO object like rdoResultset, the existing rdoResultset is not closed and removed from the rdoResultsets collection. The existing object remains open and a member of its respective collection.

In contrast, RDO 2.0 collections do not behave in this manner. When you use the Set statement to assign a variable containing a reference to an RDO object, the existing object is closed and removed from the associated collection. This change is designed to make RDO more compatible with DAO.

Managing the rdoResultsets Collection

When you use the OpenResultset method against an rdoConnection or rdoQuery, and assign the result to an existing rdoResultset object, the existing object is maintained and a new rdoResultset object is appended to the rdoResultsets collection. When performing similar operations using the Microsoft Jet database engine and Data Access Objects (DAO), existing recordset objects are automatically closed when the variable is assigned, and no two Recordsets collection members can have the same name. For example, using RDO:

Dim rs as rdoResultset
Dim cn as rdoConnection
Set cn = OpenConnection....
Set rs = cn.OpenResultset("Select * from Authors", _
    rdOpenStatic)
Set rs = cn.OpenResultset("Select * from Titles", _
    rdOpenDynamic)

This code opens two separate rdoResultset objects; both are stored in the rdoResultsets collection. After this code runs, the second query, which is stored in rdoResultsets(1), is assigned to the rdoResultset variable rs. The first query is available and its cursor is still available by referencing rdoResultsets(0). Because of this implementation, more than one member of the rdoResultsets collection can have the same name.

This behavior permits you to maintain existing rdoResultset objects, which are maintained in the rdoResultsets collection, or close them as needed. In other words, you must explicitly close any rdoResultset objects that are no longer needed. Simply assigning another rdoResultset to a rdoResultset-type variable has no affect on the existing rdoResultset formerly referenced by the variable. Note that the procedures and other temporary objects created to manage the rdoResultset are maintained on the remote server as long as the rdoResultset remains open.

If you write an application that does not close each rdoResultset before opening additional rdoResultset objects, the number of procedures maintained in TempDB or elsewhere on the server increases each time another rdoResultset object is opened. In addition those resultsets might require significant client or server resources to store keysets or row values. Over time, this behavior can overflow the capacity of the server or workstation resources.