Skip to main content
ATL Server Library Reference 
GetDataSource 

Call this function to retrieve a cached data source or add it to the cache if not already present.


static HRESULT ATL_NOINLINE GetDataSource(
   IServiceProvider * pProvider,
   LPCTSTR szID,
   LPCOLESTR szConn,
   CDataConnection * pSession 
);

Parameters

pProvider

The service provider expected to expose IDataSourceCache.

szID

The ID of the connection in the cache. Can be the same as szConn.

szConn

The connection string of the data source to which to connect.

pSession

[out] Address of the CDataConnection variable that, on success, receives a copy of the data connection.

Returns S_OK on success, or an error HRESULT on failure.

This wrapper function queries pProvider for the IDataSourceCache service and, if successful, calls IDataSourceCache::Add using the remaining arguments.

Header: atlcache.h