QueryDef Object

Represents a stored SQL procedure. An instance of this object can be retrieved with the CreateQueryDef method of the Connection and Database objects, or from the QueryDefs collection.

Properties

Name The name of the object for indentification in the collection.
SQL The stored SQL query.

Methods

CreateParameter Creates a Parameter object, that describes a parameter of stored procedure.
Parameters Provides access to the Parameters collection.
CreateProperty Creates a Property object, that describes a user-defined property.
Properties Provides access to the Properties collection.
Close Stops using the object and removes it from the collection.

Remarks

You can create a QueryDef object by using the CreateQueryDef method of the Connection and Database objects. The stored variable is created in the database when calling the Append method of the QueryDefs collection.

An SQL query stored in the QueryDef object can be executed with the help of the OpenRecordset method of the Connection and Database objects, with the name of the QueryDef object as the parameter.

QueryDef objects are based on the Transact-SQL standard. If the server doesn't support this standard, using QueryDef will cause an error. In this case you can use stored procedures only with the help of direct queries, executed by the OpenRecordset method.

See Also

Connection Object, Database Object, Property Object, Properties Object, QueryDefs Object, Append Method, CreateQueryDef Method, OpenRecordset Method.