CDaoQueryDef::CDaoQueryDef

CDaoQueryDef( CDaoDatabase* pDatabase );

Parameters

pDatabase

A pointer to an open CDaoDatabase object.

Remarks

Constructs a CDaoQueryDef object. The object can represent an existing querydef stored in the database’s QueryDefs collection, a new query to be stored in the collection, or a temporary query, not to be stored. Your next step depends on the type of querydef:

  • If the object represents an existing querydef, call the object’s Open member function to initialize it.

  • If the object represents a new querydef to be saved, call the object’s Create member function. This adds the object to the database’s QueryDefs collection. Then call CDaoQueryDef member functions to set the object’s attributes. Finally, call Append.

  • If the object represents a temporary querydef (not to be saved in the database), call Create, passing an empty string for the query’s name. After calling Create, initialize the querydef by directly setting its attributes. Do not call Append.

To set the attributes of the querydef, you can use the SetName, SetSQL, SetConnect, SetODBCTimeout, and SetReturnsRecords member functions.

When you finish with the querydef object, call its Close member function. If you have a pointer to the querydef, use the delete operator to destroy the C++ object.

For information about querydefs, see the article in Visual C++ Programmer's Guide.

CDaoQueryDef OverviewClass MembersHierarchy Chart

See Also   CDaoQueryDef::GetConnect, CDaoQueryDef::GetDateCreated, CDaoQueryDef::GetDateLastUpdated, CDaoQueryDef::GetName, CDaoQueryDef::GetODBCTimeout, CDaoQueryDef::GetReturnsRecords, CDaoQueryDef::GetSQL