Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

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_db is the CDatabase object; m_hdbc is 
// its HDBC member variable
nRetcode = ::SQLGetInfo( m_db.m_hdbc,
                         SQL_ODBC_SQL_CONFORMANCE,
                         &nValue,
                         sizeof( nValue ),
                         &cbValue );
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.