Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

CDatabase::Close 

Call this member function if you want to disconnect from a data source.


virtual void Close( );

You must close any recordsets associated with the CDatabase object before you call this member function. Because Close does not destroy the CDatabase object, you can reuse the object by opening a new connection to the same data source or a different data source.

All pending AddNew or Edit statements of recordsets using the database are canceled, and all pending transactions are rolled back. Any recordsets dependent on the CDatabase object are left in an undefined state.

// Close the current connection
m_dbCust.Close( );

// Perhaps connect the object to a
// different data source
m_dbCust.OpenEx("DSN=MYDATASOURCE;UID=JOES");
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.