Using the Data Source Cache Service


Using the data source cache in an ATL Server application is extremely simple. You can call the GetDataSource function (defined in atlcache.h) to get a pointer to a CDataConnection class as follows :

 CDataConnection dc;  GetDataSource( m_spServiceProvider,                 _T("connection_string "),                 _T("connection_string"),                 &dc )) 

This method will either return a CDataConnection object that was cached or create one and add it to the cache. The second parameter is the name given to the data source connection, and the third parameter is the connection string that the data source should use. For convenience, you should consider using the same value in both cases. That way, you can just use the connection string to reference the data source you re interested in.

In the next section you ll put everything you looked at in this chapter together and learn to use ATL Server s data source cache with OLE DB Consumer Templates and generate some HTML based on the data in your database.




ATL Server. High Performance C++ on. NET
Observing the User Experience: A Practitioners Guide to User Research
ISBN: B006Z372QQ
EAN: 2147483647
Year: 2002
Pages: 181

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