Condividi tramite


CDatabase::m_hdbc

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

Remarks

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.

Example

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

Requirements

Header: afxdb.h

See Also

Reference

CDatabase Class

Hierarchy Chart

CDatabase::OpenEx

CDatabase::Open

CDatabase::Close

Other Resources

CDatabase Members