Session Object Example

OLE DB Programmer's Reference

The code in this example shows how to create a session object.

///////////////////////////////////////////////////////////////// // myCreateSession // // Create an OLE DB session object from the given data source // object. The IDBCreateSession interface is mandatory, so this // is a simple operation. // ///////////////////////////////////////////////////////////////// HRESULT   myCreateSession    (    IUnknown *           pUnkDataSource,    IUnknown **          ppUnkSession    ) {    HRESULT              hr;    IDBCreateSession *   pIDBCreateSession = NULL;        //Create a session object from a data source object.    XCHECK_HR(hr = pUnkDataSource->QueryInterface(              IID_IDBCreateSession, (void**)&pIDBCreateSession));    XCHECK_HR(hr = pIDBCreateSession->CreateSession(              NULL,               // pUnkOuter              IID_IOpenRowset,    // riid              ppUnkSession ));    // ppSession              CLEANUP:    if( pIDBCreateSession )       pIDBCreateSession->Release();    return hr; } 

1998-2001 Microsoft Corporation. All rights reserved.



Microsoft Ole Db 2.0 Programmer's Reference and Data Access SDK
Microsoft OLE DB 2.0 Programmers Reference and Data Access SDK (Microsoft Professional Editions)
ISBN: 0735605904
EAN: 2147483647
Year: 1998
Pages: 1083

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net