共用方式為


CRecordset::CRecordset

Constructs a CRecordset object.

CRecordset( 
   CDatabase* pDatabase = NULL 
);

Parameters

  • pDatabase
    Contains a pointer to a CDatabase object or the value NULL. If not NULL and the CDatabase object's Open member function has not been called to connect it to the data source, the recordset attempts to open it for you during its own Open call. If you pass NULL, a CDatabase object is constructed and connected for you using the data source information you specified when you derived your recordset class with ClassWizard.

Remarks

You can either use CRecordset directly or derive an application-specific class from CRecordset. You can use ClassWizard to derive your recordset classes.

Note

A derived class must supply its own constructor. In the constructor of your derived class, call the constructor CRecordset::CRecordset, passing the appropriate parameters along to it.

Pass NULL to your recordset constructor to have a CDatabase object constructed and connected for you automatically. This is a useful shorthand that does not require you to construct and connect a CDatabase object prior to constructing your recordset.

Example

For more information, see the article Recordset: Declaring a Class for a Table (ODBC).

Requirements

Header: afxdb.h

See Also

Reference

CRecordset Class

Hierarchy Chart

CRecordset::Open

CRecordset::Close