From RAD Studio API Documentation
Jump to: navigation, search



TADOCommand = class(TComponent)


class PASCALIMPLEMENTATION TADOCommand : public System::Classes::TComponent


Type Visibility Source Unit Parent
class public
Data.Win.ADODB Data.Win.ADODB


TADOCommand represents an ADO command object.

The TADOCommand represents the ADO Command object. Use TADOCommand for issuing commands against a data store accessed through an ADO (ActiveX Data Objects) provider.

The TADOCommand component executes the command specified in its CommandText property. One command may be executed at a time. Parameters, if the command includes them, are specified in its Parameters property. The command is executed by a call to the Execute method.

TADOCommand can either use a TADOConnection object to connect to a data store (through its Connection property) or connect directly to the data store if the connection information is specified in the ConnectionString property.

TADOCommand is most often used for executing data definition language (DDL) SQL commands or to execute a stored procedure that does not return a result set. For SQL statements that return a result set, TADODataSet, TADOQuery, or TADOStoredProc is better suited. The Execute method of TADOCommand is, however, capable of returning a recordset. To use that recordset, however, you will need a separate ADO dataset component.

As a close representation of the ADO Command object, many of the TADOCommand properties and methods have the same name as those of the ADO Command object and serve the same purpose. For example, the CommandType property and Execute methods are the same in both the TADOCommand component and ADO Command object. Note that subsequent versions of ADO may introduce changes in the underlying ADO command object, which will change the behavior of TADOCommand. As a result, you may want to view the Microsoft Data Store SDK documentation for additional information about the behavior of TADOCommand.

See Also