Platform SDK: Broadcast Architecture

CDatabaseRecordset::OpenRecordsetQueryDef

The OpenRecordsetQueryDef method creates a recordset containing the results of the specified query. C syntax is shown.

BOOL OpenRecordsetQueryDef(
  LPCTSTR QueryName,
  LONG lType
);

Parameters

QueryName
Name of the query. For a list of queries defined in the Guide database, see Guide Database Query Reference.
lType
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 as a fixed copy of the records in the table.
dbOpenDynaset Open the recordset as a dynaset, in other words as a set of pointers to the records in the table. The dbOpenDynasetvalue is the default.
dbOpenTable Open the entire table. In this case, the QueryName parameter simply specifies the table name.

Return Values

Returns TRUE if the recordset was successfully opened, and FALSE otherwise.

Remarks

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

The record count within a recordset is not automatically defined when your application opens the recordset unless your application uses a SQL ORDER BY clause. If your application does not use ORDER BY, it can determine record count by calling the GetRecordCount method after calling OpenRecordsetQueryDef. However, GetRecordCount must move to the last record in the set. This movement can be slow for large recordsets. Use of the SQL ORDER BY clause sets the correct record count as part of the indexing process.

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

Requirements

  Windows NT/2000: Unsupported.
  Windows 95/98: Requires Windows 98.
  Header: Declared in dbsets.h.
  Import Library: Use dbsets.lib or dbsetsst.lib.

See Also

CDatabaseRecordset::GetRecordCount