Share via


Visual Basic: RDO Data Control

Close Method (Remote Data)

See Also    Example    Applies To

Closes an open remote data object.

Syntax

object**.Close**

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

Closing an open object removes it from the collection of like objects except for the rdoConnection object. For example, using the Close method on an rdoResultset removes it from the rdoResultsets collection. However, using the Close method on the rdoConnection object, simply closes and discards any subordinate objects (like rdoResultset or rdoQuery objects) but does not remove it from the rdoConnections collection.

Closing the rdoConnection object also releases its parent rdoEnvironment object. Any attempt to close the default environmentrdoEnvironments(0) is ignored. Unlike DAO, RDO collection members cannot be removed with the Delete method.

If you try to close an rdoConnection object while any rdoResultset objects are open, or if you try to close an rdoEnvironment object while any rdoConnection objects belonging to that specific rdoEnvironment are open, those rdoResultset objects are closed and any pending updates or edits are rolled back.

If the rdoConnection object is defined outside the scope of the procedure, and you exit the procedure without closing it, the rdoConnection object remains open until it is explicitly closed or the module in which it is defined is out of scope. Any rdoResultset or rdoQuery objects that are opened against the rdoConnection remain open until explicitly closed. Once all result sets are closed on an rdoConnection that is no longer in scope, the rdoConnection is closed.

If object is already closed when you use Close, a trappable error is triggered.

Note   Using the Close method against an executing action query might have unpredictable results. If the query is performing an operation that affects a number of rows, some of the rows might be changed, while others are not. For example, if you execute an action query containing an SQL UPDATE statement and use the Close method before the operation is complete, an indeterminate number of rows are updated leaving others unchanged. If you intend to use the Close method against this type of action query, it is recommended that you use transaction methods to roll back or commit partially completed operations.