CdbTableDef::OpenRecordset Method

Creates a new Recordset object and appends it to the Recordsets collection.

Syntax

CdbRecordsetOpenRecordset(LONG lType=-1,

LONG lOption=-1);

Parameters

Type Example Description
LONG lType Optional. A constant that indicates the type of Recordset to open. (See Settings in core topic).
LONG lOption Optional. A combination of constants that specify characteristics of the new Recordset. (See Settings in core topic).

Usage

#include <afxole.h>
#include <dbdao.h>

CdbDBEnghine      dben;
CdbDatabase      dbs;
CdbRecordset      rst;
CdbTableDef      td;
CdbField         fld;
   // Initialize the TableDef.
dbs = dben.OpenDatabase(...);
td = dbs.CreateTableDef(...);
fld = td.CreateField(...);
td.Fields.Append(fld);
dbs.TableDefs.Append(td);
   // Open a recordset based on the TableDef.
rst = td.OpenRecordset( dbOpenTable, dbAppendOnly );