Command Object

A Command object is a definition of a specific command that you intend to execute against a data source.



Remarks

You can create a Command object independently of a previously defined Connection object by setting its ActiveConnection property to a valid connection string. ADO still creates a Connection object, but it doesn't assign that object to an object variable. However, if you are associating multiple Command objects with the same connection, you should explicitly create and open a Connection object; this assigns the Connection object to an object variable. If you do not set the Command objects' ActiveConnection property to this object variable, ADO creates a new Connection object for each Command object, even if you use the same connection string.

Use Command objects to obtain records and create a Recordset object, to execute a bulk operation, or to manipulate the structure of a database. Depending on the functionality the provider exposes, some collections, methods, or properties of a Command object may not be available.

With the collections, methods, and properties of a Command object, you can do the following:

For a complete list of all collections, methods, and properties available on a Command object, see the Summary topic.