CDaoQueryDef::Create
Call this member function to create a new saved query or a new temporary query.
virtual void Create(
LPCTSTR lpszName = NULL,
LPCTSTR lpszSQL = NULL
);
Параметры
lpszName
The unique name of the query saved in the database. For details about the string, see the topic "CreateQueryDef Method" in DAO Help. If you accept the default value, an empty string, a temporary querydef is created. Such a query is not saved in the QueryDefs collection.lpszSQL
The SQL string that defines the query. If you accept the default value of NULL, you must later call SetSQL to set the string. Until then, the query is undefined. You can, however, use the undefined query to open a recordset; see Remarks for details. The SQL statement must be defined before you can append the querydef to the QueryDefs collection.
Заметки
If you pass a name in lpszName, you can then call Append to save the querydef in the database's QueryDefs collection. Otherwise, the object is a temporary querydef and is not saved. In either case, the querydef is in an open state, and you can either use it to create a CDaoRecordset object or call the querydef's Execute member function.
If you do not supply a SQL statement in lpszSQL, you cannot run the query with Execute but you can use it to create a recordset. In that case, MFC uses the recordset's default SQL statement.
Требования
Header: afxdao.h