The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at CDataConnection::operator CSession&.
Returns a reference to the contained CSession object.
Syntax
operator const CSession&();
Remarks
This operator returns a reference to the contained CSession object, allowing you to pass a CDataConnection object where a CSession reference is expected.
Example
If you have a function (such as func below) that takes a CSession reference, you can use CSession& to pass a CDataConnection object instead.
void SessionFunc(const CSession& theSession)
{
XACTTRANSINFO info = {0};
HRESULT hr = theSession.GetTransactionInfo(&info);
wprintf_s(_T("GetTransactionInfo returned %x\n"), hr);
}
CDataConnection dc;
dc.Open(szInit);
SessionFunc(dc);
Requirements
Header: atldbcli.h