<html>
<head>
<title>Command Object </title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="Description">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="NAME">Command Object </td>
<td valign="top" class="COMPATIBILITY">(Versions 2.0, 2.1, 2.5, 2.6)</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td valign="top" colspan="2" class="description">
<synopsis>
Dim object As ADODB.Command</synopsis>



<p>The Command object executes a SQL statement, query, or stored
procedure against a specified data source. A Command object can alter
the structure of the data source, execute large batch operations, or
select records to be returned within a Recordset object.</p>

</td></tr>
</table>
</div>
<div id="Command.ActiveConnection">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Command.ActiveConnection Property </td>
<td class="COMPATIBILITY">(Versions 2.0, 2.1, 2.5, 2.6)</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="replaceable">Command</span>.ActiveConnection = <span class="replaceable">ConnectionString</span><br>Set <span class="replaceable">Command</span>.ActiveConnection = <span class="replaceable">ConnectionObject</span></td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">


<p>The ActiveConnection property specifies the Connection object for the
current Command object.</p>

</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Datatype</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>String or Variant (containing the current Connection object)</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Description</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>The ActiveConnection property can be set to either a String,
representing a connection string, or a Variant, representing an open
Connection object.</p>


<p>The ActiveConnection property can be set to either a String or a
reference to a Connection object. If a String value is used, then it
should be a valid connection string that could be passed to the
ConnectionString property of a Connection object. You must set the
ActiveConnection property before you attempt to execute a Command
object. Before it is set, the value of the ActiveConnection property
is a <span class="LITERAL">Null</span> object reference, by default.</p>


<p>If you set the ActiveConnection property to a closed Connection
object, ADO will generate an error. If you set it to
<span class="LITERAL">Nothing</span>, ADO will disassociate the Command object
from the Connection object and release any resources that are
associated with the data source. If the ActiveConnection property is
set to either <span class="LITERAL">Nothing</span> or a different Connection
object, those Parameter objects that were supplied by the data
provider, residing in the Command's Parameters collection
class, will be lost. However, those Parameter objects that were
manually added to the Parameters collection class will not.</p>


<p>If you close the Connection object associated with a Command object,
the Command object's ActiveConnection will automatically be set
to <span class="LITERAL">Nothing</span>.</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">See Also</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Connection.ConnectionString Property</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Command.Cancel">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Command.Cancel Method </td>
<td class="COMPATIBILITY">(Versions 2.0, 2.1, 2.5, 2.6)</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><br><span class="replaceable">Command</span>.Cancel</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">


<p>The Cancel method cancels the pending asynchronous command that is
executing.</p>

</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Description</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>The Cancel method cancels an asynchronous executing command that was
initiated with the Execute method using the
<span class="LITERAL">adAsyncExecute</span> option.</p>


<p>If the Cancel method is called on a command that was not executed
with the <span class="LITERAL">adAsyncExecute</span> option set, an error will
occur.</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">See Also</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Command.Execute Method</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Command.CommandStream">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Command.CommandStream Property </td>
<td class="COMPATIBILITY">(Version 2.6)</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><br><span class="replaceable">Command</span>.CommandStream = <span class="replaceable">Stream</span></td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">


<p>The CommandStream property sets or returns the data provider-specific
stream that is used as the Command's input just as the
CommandText property identifies the command to use as the input.</p>

</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Datatype</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Variant</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Description</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>The CommandStream property is used to specify the stream used as a
Command's input. If this property is set, then the CommandText
property is set to an empty String ("). Similarly, if
the CommandText property is set, the CommandStream property is set to
<span class="LITERAL">Nothing</span>.</p>


<p>If a Command object whose source is a stream is used to create a
Recordset object, reading the Recordset object's Source
property would return an empty String ("), because it
returns the value of the Command object's CommandText property.</p>


<p>You must use either the <span class="LITERAL">adCmdText</span> or
<span class="LITERAL">adCmdUnknown</span> enumeration values for the
CommandType property if the CommandStream property is set.</p>


<p>The format of the stream being set to the CommandStream property is
data provider-specific, as is the behavior of both the
Command.Parameters.Refresh and Command.Prepare methods.</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">See Also</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Command.CommandText Property, Comand.CommandDialect Property,
CommandTypeEnum Enumeration, Recordset.Source</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Command.CommandText">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Command.CommandText Property </td>
<td class="COMPATIBILITY">(Versions 2.0, 2.1, 2.5, 2.6)</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><br><span class="replaceable">Command</span>.CommandText = <span class="replaceable">CommandText</span></td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">


<p>The CommandText property sets or returns a valid SQL statement, table
name, stored procedure name, relative URL, or any other command text
that the data provider may recognize.</p>

</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Datatype</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>String</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Description</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>The CommandText property contains a String value that by default
contains a zero-length string ("). This string can be
set to a SQL statement, table name, stored procedure call, relative
URL, or any other command text that the data provider may recognize.</p>


<p>The CommandType property is used to indicate to ADO what type of
information resides within the CommandText property. If the
CommandType property is set to <span class="LITERAL">adCmdText</span>, it
indicates to the provider that the CommandText property value
contains a text command that the provider will understand. This will
usually be a SQL statement, but not necessarily.</p>


<p>If you set the CommandText property, ADO prepares the specified query
on the Execute or Open methods whenever the Prepared property of the
Command object is set to <span class="LITERAL">True</span>, and it is bound to
an open connection.</p>


<p>The value of CommandText may be changed by ADO, depending on the
value of the CommandType property. Retrieve the value of the
CommandText property at any time if you question its value.</p>


<p>If the CommandStream property is set to a value, then the CommandText
property is automatically set to an empty string (").</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">See Also</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Command.CommandStream, Command.CommandType Property, Command.Dialect
Property, Command.Prepared Property</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Command.CommandTimeout">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Command.CommandTimeout Property </td>
<td class="COMPATIBILITY">(Versions 2.0, 2.1, 2.5, 2.6)</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><br><span class="replaceable">Command</span>.CommlandTimeout = <span class="replaceable">Seconds</span></td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">


<p>The CommandTimeout property indicates how long ADO waits, in seconds,
before it generates an error when executing an asynchronous command.</p>

</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Datatype</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Long</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Description</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>The CommandTimeout property is read- and write-enabled. With the
CommandTimeout property, you can specify how long ADO will wait for a
command to execute. The setting for the CommandTimeout property is
represented in seconds, and the default value is 30. By setting this
property to zero, you are allowing ADO to wait indefinitely for a
specified command to execute. If a command does timeout, an error is
generated.</p>


<p>The CommandTimeout property of the Command object is unrelated to the
CommandTimeout property of the Connection object.</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Note</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Not all providers support the CommandTimeout property. Check your
data provider's documentation to see if it supports this
property. When developing an application with ADO, it might be a good
idea to go as far as checking the capabilities of your planned data
provider to see whether it matches your needs before you write most
of your code -- and it becomes too late.</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">See Also</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Command.Execute Method, Connection.CommandTimeout Property</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Command.CommandType">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Command.CommandType Property </td>
<td class="COMPATIBILITY">(Versions 2.0, 2.1, 2.5, 2.6)</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><br><span class="replaceable">Command</span>.CommandType = <span class="replaceable">CommandTypeEnum</span></td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">


<p>The CommandType property indicates the current type of Command object.</p>

</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Datatype</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>CommandTypeEnum</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Description</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>The CommandType property indicates the type of Command object you are
using. The value of this property can be set to one of the
CommandTypeEnum enumeration values. If the source of the Command
object is a stream (set via the Command.CommandStream property), the
CommandType property must be set to either
<span class="LITERAL">adCmdText</span> or <span class="LITERAL">adCmdUnknown</span>.</p>


<p>In addition, the ExecuteOptionEnum value of
<span class="LITERAL">adExecuteNoRecords</span> can be combined with the
<span class="LITERAL">adCmdText</span> or <span class="LITERAL">adCmdStoredProc</span>
constants to improve performance. This value cannot be used with the
Open method of the Recordset object.</p>


<p>If you know the type of Command object that you are using, set this
property manually to prevent unwanted delays in performance when ADO
tries to figure it out for itself. If the property is set
incorrectly, an error is generated upon a call to the Execute method.</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">See Also</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Command.CommandStream, Command.CommandText Property, CommandTypeEnum
Enumeration</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Command.CreateParameter">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Command.CreateParameter Method </td>
<td class="COMPATIBILITY">(Versions 2.0, 2.1, 2.5, 2.6)</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><br>Set <span class="replaceable">parameter = command</span>.CreateParameter(<span class="replaceable">Name, Type, Direction, Size, Value</span>)</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">


<p>The CreateParameter method creates and returns a new parameter with
the information supplied.</p>

</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Arguments</td>
</tr>
<tr>
<td colspan="2" class="description">


<dl>
<dt><span class="replaceable">Name</span> (String)</dt>
<dd><p>Optional. Contains the desired name of the new parameter. This
argument is mapped to the Parameter.Name property.</p></dd>

</dl>


<dl>
<dt><span class="replaceable">Type</span> (DataTypeEnum)</dt>
<dd><p>Optional. Indicates the desired datatype of the new parameter. This
argument is mapped to the Parameter.Type property. The default value
is <span class="LITERAL">adEmpty</span>.</p></dd>

</dl>


<dl>
<dt><span class="replaceable">Direction</span> (ParameterDirectionEnum)</dt>
<dd><p>Optional. Indicates the desired direction of the new parameter. This
argument is mapped to the Parameter.Direction property. The default
value is <span class="LITERAL">adParamImput</span>.</p></dd>

</dl>


<dl>
<dt><span class="replaceable">Size</span> (Long)</dt>
<dd><p>Optional. Specifies the maximum length of the newly created parameter
in either characters or bytes if the Type parameter is set to a
variable-length datatype. This argument is mapped to the
Parameter.Size property.</p></dd>

</dl>


<dl>
<dt><span class="replaceable">Value</span> (Variant)</dt>
<dd><p>Optional. Is used to initialize the value of the newly created
Parameter object. This argument is mapped to the Parameter.Value
property.</p></dd>

</dl>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Returns</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Parameter object</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Description</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>With the CreateParameter method of the Command object, you can create
a new Parameter object with the information that you specify,
including name, type, direction, size, and value. When you create a
new Parameter object with this method, the parameter is not
automatically added to the Parameters collection of the chosen
Command object. The Append method of the Command.Parameters property
must be used to do this.</p>


<p>When assigning variable-length datatypes, you must set the Size
property at either creation or some other time before appending it to
the Parameters collection to avoid an error.</p>


<p>If the Type property is set to either <span class="LITERAL">adNumeric</span> or
<span class="LITERAL">adDecimal</span>, the Parameter.NumericScale and
Parameter.Precision properties must be set to fully specify the
parameter's datatype. For instance, a NumericScale of
<span class="LITERAL">3</span> would indicate that there are three digits after
the decimal point and a Precision of <span class="LITERAL">5</span> would mean
that there are five digits, total, representing the number.</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">See Also</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>DataTypeEnum Enumeration, ParameterDirectionEnum Enumeration,
Parameter.Direction Property, Parameter.Name Property,
Parameter.NumericScale Property, Parameter.Precision Property,
Parameter.Size Property, Parameter.Type Property, Parameter.Value
Property</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Command.Dialect">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Command.Dialect Property </td>
<td class="COMPATIBILITY">(Version 2.6)</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><br>Command.<span class="replaceable">Dialect</span> = <span class="replaceable">GUID</span></td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">


<p>The Dialect property is used with the CommandText and the
CommandStream properties to indicate the data provider-specific
syntax of the Command's source.</p>

</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Datatype</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>String</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Description</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>The default value for the Dialect property is
<span class="LITERAL">{C8B521FB-5CF3-11CE-ADE5-00AA0044773D}</span>, which
indicates to ADO that the provider will attempt to figure out how to
interpret the Command's source specified in either the
CommandStream or the CommandText property.</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Note</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>You must check your data provider's documentation to see what
the valid values of the Dialect property must be specified as,
depending upon the value in the CommandStream or CommandText
properties.</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">See Also</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Command.CommandStream Property, Command.CommandText Property</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Command.Execute">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Command.Execute Method </td>
<td class="COMPATIBILITY">(Versions 2.0, 2.1, 2.5, 2.6)</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><br>Set <span class="replaceable">recordset = command</span>.Execute(<span class="replaceable">RecordsAffected, Parameters, Options</span>)<br>Set <span class="replaceable">stream = command</span>.Execute(<span class="replaceable">RecordsAffected, Parameters, Options</span>)<br><span class="replaceable">command</span>.Execute <span class="replaceable">RecordsAffected, Parameters, Options</span></td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">


<p>The Execute method executes a SQL statement, query, or stored
procedure specified in the Command.CommandText property value.</p>

</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Arguments</td>
</tr>
<tr>
<td colspan="2" class="description">


<dl>
<dt><span class="replaceable">RecordsAffected</span> (Long)</dt>
<dd><p>Optional. Populated, by the data provider, with the number of records
that were affected by the action SQL statement, query, or stored
procedure (result-returning commands do not populate this parameter).</p></dd>

</dl>


<dl>
<dt><span class="replaceable">Parameters</span> (Variant Array)</dt>
<dd><p>Optional. Contains the values to be passed to the SQL statement,
query, or stored procedure for the parameters in which it holds.</p></dd>

</dl>


<dl>
<dt><span class="replaceable">Options</span> (Long)</dt>
<dd><p>Optional. A combination of one or more CommandTypeEnum and
ExecuteOptionEnum values indicating how the data provider should
treat the command. The default value is <span class="LITERAL">-1</span> (no
options set). The CommandTypeEnum values can also be set with the
Command.CommandType property.</p></dd>

</dl>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Returns</td>
</tr>
<tr>
<td colspan="2" class="description">


<simplelist>

<member>Recordset object</member>

</simplelist>


<simplelist>

<member>Stream object</member>

</simplelist>


<simplelist>

<member>Nothing</member>

</simplelist>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Description</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>The Execute method executes a stored procedure, SQL statement, or
query against a data source. The command that is executed is
dependent upon the value of the Command.CommandText property. The way
in which ADO evaluates this CommandText is dependent upon the Options
parameter to the Execute method.</p>


<p>If the CommandText value causes the Execute method to return records
from the data source, these records are returned in the form of a
Recordset object from the Execute method. A returned Recordset object
from the Command.Execute method is always a read-only, forward-only
cursor.</p>


<p>When the Execute method's Options parameter includes the
<span class="LITERAL">adAsyncExecute</span>, <span class="LITERAL">adAsyncFetch</span>,
or <span class="LITERAL">adAsyncFetchNonBlocking</span> values, operations
continue in the background of the application flow. While these
operations are continuing, the Command.Cancel method can be called to
cancel all pending asynchronous operations.</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">See Also</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Command.Cancel Method, Command.CommadText Property,
Command.CommandType Property, CommandTypeEnum Enumeration,
ExecuteOptionEnum Enumeration, ExecuteOptionEnum Enumeration</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Command.Name">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Command.Name Property </td>
<td class="COMPATIBILITY">(Versions 2.0, 2.1, 2.5, 2.6)</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><br><span class="replaceable">command</span>.Name = <span class="replaceable">Name</span></td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">


<p>The Name property specifies the name for the current Command object.</p>

</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Datatype</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>String</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Description</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>The Name property is both read- and write-enabled for the Command
object. The Name property is used to assign a name to the associated
Command object or retrieve a Command object from the Commands
collection.</p>


<p>Names do not have to be unique within collections.</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Command.NamedParameters">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Command.NamedParameters Property </td>
<td class="COMPATIBILITY">(Version 2.6)</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><br><span class="replaceable">command</span>.NamedParameters = <span class="replaceable">Boolean</span></td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">


<p>The NamedParameters property indicates whether the data provider
should use parameter names to match the Command object's
parameters or if it should match them in the order that they appear.</p>

</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Datatype</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Boolean</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Description</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>If the NamedParameters property is set to <span class="LITERAL">True</span>,
the name properties of each Parameter object in the current Command
objects, Parameters collection, will be passed to the data provider
so that they can be used to map the parameters to the values in
either the CommandText or the CommandStream Property.</p>


<p>If this property is set to <span class="LITERAL">False</span>, then the
parameters are not matched by name, but rather by the order in which
they appear.</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">See Also</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Command.CommandText Property, Command.CommandStream Property,
Parameters Collection</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Command.Parameters">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Command.Parameters Collection </td>
<td class="COMPATIBILITY">(Versions 2.0, 2.1, 2.5, 2.6)</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><br>Set <span class="replaceable">parameters</span> = <span class="replaceable">command</span>.Parameters</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">


<p>The Parameters collection returns a collection of parameters for the
given Command object.</p>

</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Datatype</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Parameters (Collection object)</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Applies To</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Command object</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Description</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>The Parameters property of the Command object is read-only. It
returns a reference to the Parameters collection object, which can
contain zero or many Parameter objects that represent parameters for
the given command.</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Command.Prepared">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Command.Prepared Property </td>
<td class="COMPATIBILITY">(Versions 2.0, 2.1, 2.5, 2.6)</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><br><span class="replaceable">command</span>.Prepared = <span class="replaceable">Boolean</span></td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">


<p>The Prepared property indicates whether a prepared statement should
be created by the current Command object before it is executed.</p>

</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Datatype</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Boolean</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Description</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>If the value of the Prepared property is set to
<span class="LITERAL">True</span>, then before the first execution of a query
defined by the CommandText property of the Command object, the query
is compiled and saved. From then on the Execute statement will refer
to the compiled version of the query to perform. This may slow the
initial call to Execute, but all calls that follow will benefit from
this.</p>


<p>If the value of the Prepared property is set to
<span class="LITERAL">False</span>, then the query is never compiled; instead
the query is done directly from the Command object.</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Note</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Not all providers support the Prepared property. Some providers raise
an error as soon as the Prepared property is set to
<span class="LITERAL">True</span>, while others do not raise an error and
simply replace the Prepared property's value with
<span class="LITERAL">False</span>.</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Command.Properties">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Command.Properties Collection </td>
<td class="COMPATIBILITY">(Versions 2.0, 2.1, 2.5, 2.6)</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><br>Set <span class="replaceable">properties</span> = <span class="replaceable">command</span>.Properties</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">


<p>The Properties property returns a Properties Collection class that
contains characteristics specific to the Command object for the
currently used provider.</p>

</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Datatype</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Properties (Collection object)</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Applies To</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Command object</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Description</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>The Properties collection class contains a Property class instance
for each property specific to the Command object for the data
provider.</p>


<p>The Properties collection of the Command object is not populated
until the ActiveConnection property of the Command object has been
set to an open Connection object or a valid connection string value.</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">See Also</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Command.ActiveConnection Property</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Command.State">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Command.State Property </td>
<td class="COMPATIBILITY">(Versions 2.0, 2.1, 2.5, 2.6)</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><br><span class="replaceable">state</span> = <span class="replaceable">command</span>.State</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">


<p>The Status property is used to determine the status of the current
record when using batch updates or bulk operations.</p>

</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Datatype</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>RecordStatusEnum</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">Description</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>The Type property is used to check the changes that are pending for
records that have changed during a batch update. In addition, you can
check the status of records that have failed during bulk operations
such as what might happen with a call to the Delete, Resync,
UpdateBatch, or CancelBatch methods or when a Filter property is set
to an array of bookmarks.</p>


<p>The Type property returns a sum of one or more of the
RecordStatusEnum enumerations.</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="TITLE">See Also</td>
</tr>
<tr>
<td colspan="2" class="description">


<p>Recordset.CancelBatch, Recordset.Delete Method, Recordset.Filter
Property, Recordset.Resync Method, Recordset.UpdateBatch,
RecordStatusEnum Enumeration, ObjectStateEnum Enumeration</p>


</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
</body>
</html>