다음을 통해 공유


CDataConnection::operator CSession&

Returns a reference to the contained CSession object.

operator const CSession&();

설명

This operator returns a reference to the contained CSession object, allowing you to pass a CDataConnection object where a CSession reference is expected.

예제

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

요구 사항

헤더: atldbcli.h

참고 항목

참조

CDataConnection 클래스

CDataConnection::operator CSession*