Condividi tramite


CDataConnection::operator CSession&

Returns a reference to the contained CSession object.

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

See Also

Reference

CDataConnection Class

CDataConnection::operator CSession*

Other Resources

CDataConnection Members