Compartilhar via


CDaoQueryDef::CDaoQueryDef

Constructs a CDaoQueryDef object.

CDaoQueryDef(
   CDaoDatabase* pDatabase 
);

Parameters

Remarks

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.

Requirements

Header: afxdao.h

See Also

Reference

CDaoQueryDef Class

Hierarchy Chart

CDaoQueryDef::GetConnect

CDaoQueryDef::GetDateCreated

CDaoQueryDef::GetDateLastUpdated

CDaoQueryDef::GetName

CDaoQueryDef::GetODBCTimeout

CDaoQueryDef::GetReturnsRecords

CDaoQueryDef::GetSQL

Other Resources

CDaoQueryDef Members