Command Object
Description
Represents a database command.
Remarks

The Command object represents a database command.  You can use a Command object to query the database and return records in a Recordset Object, to execute a bulk operation, and to manipulate the structure of the database.

The Command object is intrinsically unsafe because it bypasses all the business logic of ALM and acts directly on the database. The Command object also does not validate input format. For example, you can successfully insert a value in a user-defined field of type Float although user-defined fields do not support floating values.

It is included in the API to enable the user to solve unforeseen problems. Before determining that there is no other solution to your application problem, consult your support service representative to investigate other options.

The use of the Command object for a simple Select statement that does not change the database is safe but may affect ALM Performance.

Because of the risk, use of the Command object is restricted. For information about security and rights to use the Command object, refer to the ALM Administrator Guide.

Get a Command object from TDConnection.Command.

Example
Dim com As TDAPIOLELib.Command
Dim RecSet As TDAPIOLELib.Recordset

' Setting and executing the SQL
    Set com = tdc.Command
    com.CommandText = "select * from bug"
    Set RecSet = com.Execute


' Displaying the 2nd column data
    For i = 1 To RecSet.RecordCount
        List1.AddItem (RecSet.FieldValue(2))
        RecSet.Next
    Next
Public Methods
Public Method AddParamAdds new parameter to Command object.
Public Method CancelCancels execution of the ExecuteQuery command.
Public Method DeleteParamDeletes the specified parameter from Command object.
Public Method DeleteParamsDeletes all parameters from Command object.
Public Method ExecuteExecutes the command in the CommandText property.
Public Properties
Public Property AffectedRowsThe number of table rows that were affected by the command.
Public Property CommandTextThe text of the command.
Public Property CountNumber of parameters in current command.
Public Property IndexFieldsA comma-separated list of index fields for a SELECT command.
Public Property ParamIndexThe parameter index by parameter name.
Public Property ParamNameThe parameter name by parameter index. The index is 0-based.
Public Property ParamTypeThe data type of the specified parameter. The index is 0-based.
Public Property ParamValueThe parameter value.
See Also