Export (0) Print
Expand All
1 out of 10 rated this helpful - Rate this topic

CDatabase Class 

Represents a connection to a data source, through which you can operate on the data source.


class CDatabase : public CObject

A data source is a specific instance of data hosted by some database management system (DBMS). Examples include Microsoft SQL Server, Microsoft Access, Borland dBASE, and xBASE. You can have one or more CDatabase objects active at a time in your application.

NoteNote

If you are working with the Data Access Objects (DAO) classes rather than the Open Database Connectivity (ODBC) classes, use class CDaoDatabase instead. For more information, see the article Overview: Database Programming.

To use CDatabase, construct a CDatabase object and call its OpenEx member function. This opens a connection. When you then construct CRecordset objects for operating on the connected data source, pass the recordset constructor a pointer to your CDatabase object. When you finish using the connection, call the Close member function and destroy the CDatabase object. Close closes any recordsets you have not closed previously.

For more information about CDatabase, see the articles Data Source (ODBC) and Overview: Database Programming.

Header: afxdb.h

This class is not supported in Smart Device projects.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.