IDBCreateSession::CreateSession

Creates a new session from the data source object and returns the requested interface on the newly created session.

HRESULT CreateSession (
   IUnknown *   pUnkOuter,
   REFIID         riid,
   IUnknown **   ppDBSession);

Parameters

pUnkOuter

[in]
A pointer to the controlling IUnknown interface if the new session is being created as part of an aggregate. It is a null pointer if the session is not part of an aggregate.

riid

[in]
The IID of the interface.

ppDBSession

[out]
A pointer to memory in which to return the interface pointer.

Return Code

S_OK
The method succeeded.

E_FAIL
A provider-specific error occurred.

E_INVALIDARG
ppDBSession was a null pointer.

E_NOINTERFACE
The session did not support the interface specified in riid.

E_OUTOFMEMORY
The provider did not have enough memory to create the session.

E_UNEXPECTED
The data source object was in an uninitialized state.

DB_E_NOAGGREGATION
pUnkOuter was not a null pointer and the session being created does not support aggregation.

pUnkOuter was non-null and riid was not IID_Unknown.

DB_E_OBJECTCREATIONLIMITREACHED
The maximum number of sessions supported by the provider has already been created. The consumer must release one or more currently held sessions before obtaining a new session object. This error is only returned by providers that have a fixed maximum number of sessions as returned by DBPROP_ACTIVESESSIONS. It is not returned due to other resource constraints, such as available memory (for which the provider returns E_OUTOFMEMORY).

DB_E_OBJECTOPEN
The provider would have to open a new connection to support the operation and DBPROP_MULTIPLECONNECTIONS is set to VARIANT_FALSE.

See Also

IDBProperties::GetPropertyInfo, ISessionProperties::SetProperties