This documentation is archived and is not being maintained.


Contains a public handle to an ODBC data source connection — a "connection handle."


Normally, you will have no need to access this member variable directly. Instead, the framework allocates the handle when you call OpenEx or Open. The framework deallocates the handle when you call the delete operator on the CDatabase object. Note that the Close member function does not deallocate the handle.

Under some circumstances, however, you may need to use the handle directly. For example, if you need to call ODBC API functions directly rather than through class CDatabase, you may need a connection handle to pass as a parameter. See the code example below.


// Using m_hdbc for a direct ODBC API call.
// m_db is the CDatabase object; m_hdbc is 
// its HDBC member variable
nRetcode = ::SQLGetInfo( m_db.m_hdbc,
                         sizeof( nValue ),
                         &cbValue );

See Also

CDatabase Overview | Class Members | Hierarchy Chart | CDatabase::OpenEx | CDatabase::Open | CDatabase::Close