Ø A DAO
querydef, represented in MFC by a CDaoQueryDefobject, is
a query definition.
Ø The object
defines the SQL statement for a query and provides operations for executing the
query, for saving it in the database for reuse, for parameterizing the query,
and more.
Ø Saved queries are advantageous because you can keep
frequently used queries, especially complex ones, for easy reuse later.
Ø USES:
·
Creating recordsets, which you then open to run the
query.
•Directly
executing queries that don't return records. These include action queries and
some SQL pass-through queries (those that return no records).
Ø QueryDef Parameters:A query parameter is an element containing a value that you can change
to affect the results of the query. For example, a query returning data about
an employee might have a parameter for the employee's name. It has two major
advantages:
·
It can result in better execution speed, particularly on
the second and subsequent requeries.
·
It lets you build a query at run time, based on
information not available to you at design time, such as information that you
must obtain from the user or information that you must calculate.
Ø Each DAO
database object maintains a QueryDefs collection — a collection of all saved
querydefs in the database. Each querydef object maintains two collections of
its own:
· Parameters. All defined parameters for the query.
· Fields. The fields in one or more tables that
correspond to the parameters. For example, an Employee Name field corresponds
to an Employee Name parameter.
No comments:
Write comments