A CdbConnection object represents a connection to an ODBC database (ODBCDirect workspaces only).
Remarks
A CdbConnection is a non-persistent object that represents a connection to a remote database. The CdbConnection object is only available in ODBCDirect workspaces (that is, a CdbWorkspace object created with the type option set to dbUseODBC).
Note Code written for earlier versions of DAO can continue to use the CdbDatabase object for backward compatibility, but if you want the new features of a CdbConnection, revise the code to use the CdbConnection object. To help with code conversion, you can obtain a CdbConnection object reference from a CdbDatabase by reading the Connection property of the CdbDatabase object. Conversely, you can obtain a CdbDatabase object reference from the CdbConnection object’s Database property.
CdbConnection Constructor Syntax
Use any one of the following three constructors. The qualifier 'CONSTRUCTOR' in the syntax models is provided to help readability. It has no syntactic value.
CONSTRUCTORCdbConnection(VOID);
This constructor creates an instance of the class. There are no parameters.
CONSTRUCTORCdbConnection(const CdbConnection &);
Type | Description |
const CdbConnection & | Reference to the object. |
This constructor creates a copy of the object referenced in the parameter.
CONSTRUCTORCdbConnection(DAOConnection *pconn,
BOOL bAddRef = FALSE);
Type | Argument | Description |
DAOConnection * | pconn | A DAO Automation interface pointer corresponding to this DAO class. |
BOOL | bAddRef =FALSE |
Optional. A Boolean. If TRUE, the DAO Automation interface AddRef function is called. |
DAO functionality is presented through pointers to DAO Automation interfaces. This constructor makes a DAO interface available in the form of a DAO class object that provides additional functionality.
This constructor is not required for typical use. It is provided to enable you to easily create a DAO class object when you have access to the corresponding DAO interface.
When the destructor for the DAO object is invoked, the underlying Automation interface's Release member is called. If Release decrements the interface's reference count to zero, the pointer to the Automation interface can be deleted. If you don't want this to happen (for example, because you want to discard the DAO object, but continue using the Automation interface), specify TRUE for the second parameter. The underlying Automation interface's AddRef member is called, which counterbalances the eventual call to Release.