ADO and RDS Objects
OBJECT: Command
Command
The ADO
Command
object is used to submit and execute a specific (single) query against a database. The query can command a variety of actions, such as adding, creating, deleting, retrieving, or updating databases (record sets).
If the query is used to retrieve data, then the data will be returned as a
RecordSet
object. This means that the retrieved data can be manipulated by the sixty-four properties, collections, methods, and events that belong to the
Recordset
object. Also with ADO 2.6, the performance of command queries that only return a single row has been greatly improved.
One of the major features of the
Command
object is the ability to use stored queries and procedures that accept parameters. This requires access to the
Parameter
collection, which is a collection that is unique to the
Command
object.
You can also use the
Execute
method of the
Connection
object or the
Open
method of the
RecordSet
object to query a database. However, these queries lack the great versatility offered by the properties, collections, methods, and events that are associated with the
Command
object. (For example, you cannot use parameterized queries.)
PROPERTIES
ActiveConnection Property
Sets or returns a variant value defining the
Connection
object to which the
Command
object belongs, or returns a string value if there is no connection.
Syntax:
commandobject.
ActiveConnection
CommandStream Property
Identifies the
Stream
object containing the command details.
Syntax:
commandobject.
CommandStream
CommandText Property
Sets or returns the text of a command statement to be applied against a data provider.
Syntax:
commandobject.
CommandText
CommandTimeout Property
The number of seconds to wait while attempting to execute a command, before cancelling the attempt and generating an error.
Syntax:
commandobject.
CommandTimeout
CommandType Property
Sets or returns the
CommandTypeEnum
type of the
Command
object.
Syntax:
commandobject.
CommandType
Dialect Property
Sets or returns the dialect to be used for the
CommandStream
or
CommandText
properties.
Syntax:
commandobject.
Dialect
Name Property
Sets or returns the string name of the
Command
object.
Syntax:
commandobject.
Name
NamedParameters Property
Sets or returns a boolean that determines whether or not parameter names should be passed to the provider.
Syntax:
commandobject.
NamedParameters
Prepared Property
Sets or returns a Boolean value that indicates whether or not the provider is to save a compiled version of a command before it is executed.
Syntax:
commandobject.
Prepared
State Property
Returns a long value describing if the
Command
object is open, closed or in the process of connecting, executing or retrieving.
Syntax:
commandobject.
State
COLLECTIONS
Parameters Collection
A collection of
Parameter
objects that allow the passing of parameters into stored queries and stored procedures.
Properties Collection
A collection of
Property
objects. Each
Property
object contains a provider-specific property.
METHODS
Cancel Method
Cancels the execution of a pending
Execute
call.
Syntax:
commandobject.
Cancel
CreateParameter Method
Creates a new
Parameter
object.
Syntax:
commandobject.
CreateParameter
(Name, Type, Direction, Size, Value)
Execute Method
Executes the query, SQL statement or stored procedure.
Syntax:
commandobject.
Execute
(NumberRecords, Parameters, Options)
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information