Export (0) Print
Expand All

CDatabase::m_hdbc

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_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);

Header: afxdb.h

Community Additions

ADD
Show:
© 2014 Microsoft