Connections Collection

           

A Connections collection contains the current CdbConnection objects of a CdbWorkspace object. (ODBCDirect workspaces only).






Remarks

When you open a CdbConnection object, it is automatically appended to the Connections collection of the CdbWorkspace. When you close a CdbConnection object with the Close method, it is removed from the Connections collection. Close all open CdbRecordset objects within the CdbConnection before closing it.

At the same time you open a CdbConnection object, a corresponding CdbDatabase object is created and appended to the Databases collection in the same CdbWorkspace, and vice versa. Similarly, when you close the CdbConnection, the corresponding CdbDatabase is deleted from the Databases collection, and so on.

The Name property setting of a CdbConnection is a string that specifies the path of the database file. To refer to a CdbConnection object in a collection by its ordinal number or by its Name property setting, use any of the following syntax forms:

Connections[0]

Connections["name"]

Note You can open the same data source more than once, creating duplicate names in the Connections collection. You should assign CdbConnection objects to object variables and refer to them by variable name.