Share via


CDatabase::CDatabase

CDatabase();

Remarks

Constructs a CDatabase object. After constructing the object, you must call its OpenEx or Open member function to establish a connection to a specified data source.

You may find it convenient to embed the CDatabase object in your document class.

Example

// This example illustrates using CDatabase
// in a CDocument-derived class.

class CMyDocument : public CDocument
{
public:
   // Declare a CDatabase embedded in the document
   CDatabase m_dbCust;
   // ...
};

// ...

// Initialize when needed
CDatabase* CMyDocument::GetDatabase( )
{
   // Connect the object to a data source
   if( !m_dbCust.IsOpen( ) &&
       !m_dbCust.OpenEx( NULL ) )
      return NULL;

   return &m_dbCust;
}

CDatabase OverviewClass MembersHierarchy Chart

See Also   CDatabase::OpenEx, CDatabase::Open