RAD Studio |  |

Using Command Objects
See Also
Collapse All

In the ADO environment, commands are textual representations of provider-specific action requests. Typically, they are Data Definition Language (DDL) and Data Manipulation Language (DML) SQL statements. The language used in commands is provider-specific, but usually compliant with the SQL-92 standard for the SQL language.

Although you can always execute commands using TADOQuery, you may not want the overhead of using a dataset component, especially if the command does not return a result set. As an alternative, you can use the TADOCommand component, which is a lighter-weight object designed to execute commands, one command at a time. TADOCommand is intended primarily for executing those commands that do not return result sets, such as Data Definition Language (DDL) SQL statements. Through an overloaded version of its Execute method, however, it is capable of returning a result set that can be assigned to the RecordSet property of an ADO dataset component.

In general, working with TADOCommand is very similar to working with TADODataSet, except that you can't use the standard dataset methods to fetch data, navigate records, edit data, and so on. TADOCommand objects connect to a data store in the same way as ADO datasets. See Connecting an ADO dataset to a data store for details.

The following topics provide details on how to specify and execute commands using TADOCommand:

- Specifying the command
- Using Command objects
- Canceling commands
- Retrieving result sets with commands
- Handling command parameters

See Also

Using TADODataSet

Connecting to ADO Data Stores

Using the Execute Method

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!