Creates a new Recordset object and appends it to the Recordsets collection.
Syntax
CdbRecordsetOpenRecordset(LPCTSTR pstrName,
LONG lType=-1,
LONG lOptions=-1,
LONG lLockEdit=-1);
Parameters
Type | Example | Description |
LPCTSTR | pstrName | A pointer to a string specifying the source of the records for the new Recordset. The source can be a table name, a query name, or an SQL statement that returns records. For table-type Recordset objects in Microsoft Jet databases, the source can only be a table name. |
LONG | lType | Optional. A constant that indicates the type of Recordset to open, as specified in Settings in the core topic. |
LONG | lOptions | Optional. A combination of constants that specify characteristics of the new Recordset, as listed in Settings in the core topic. |
LONG | lLockEdit | Optional. A constant that determines the locking for the Recordset, as specified in Settings in the core topic. |
Usage
#include <afxole.h>
#include <dbdao.h>
CdbDatabase db;
CdbRecordset rst;
CString strSql = _T("SELECT * FROM PARTS");
... // Initialize db, etc.
rst = db.OpenRecordset((LPCTSTR)strSql, dbOpenDynaset, dbDenyWrite, dbPessimistic);