CDatabaseRecordset::OpenRecordsetQueryDef

[This is preliminary documentation and subject to change.]

The OpenRecordsetQueryDef method creates a recordset containing the results of the specified query.

BOOL OpenRecordsetQueryDef(
  LPCTSTR QueryName,  
  long lType          
);
 

Parameters

QueryName
Specifies the name of the query. For a list of queries defined in the Guide database, see Guide Database Query Reference.
lType
An optional parameter that specifies whether the Jet database engine opens the recordset as a snapshot or a dynaset.

This parameter can be one of the following values.
Value Meaning
dbOpenSnapshot     Open the recordset as a snapshot, in other words, create a fixed copy of the records in the table.
dbOpenDynaset Open the recordset as a dynaset, a set of pointers to the records in a table. This is the default.
dbOpenTable Open the entire table. In this case, the QueryName parameter simply specifies the table name.

Return Values

If the recordset was successfully opened, this method returns TRUE. Otherwise it returns FALSE.

Remarks

You can reuse recordset objects by opening and closing a single recordset object multiple times. This is more efficient than deleting and creating a new instance of a recordset object.

The record count is not automatically defined when you open a recordset. Therefore, when you call GetRecordCount, the method must move to the last record in the set. This can be slow for large recordsets. However, recordsets opened with an ORDER BY clause correctly set the initial record count.

In the case of large recordsets, opening the recordset as a snapshot can degrade performance.

QuickInfo

  Windows NT: Unsupported.
  Windows: Requires Windows 98.
  Windows CE: Unsupported.
  Header: Declared in dbsets.h.
  Import Library: Use dbsets.lib or dbsetsSt.lib.
  Unicode: Yes.