The Command Object

The Command object represents a SQL statement, query, or stored procedure that is executed against a data source. Just like a Connection object, you must declare and instantiate a Command object before you can use it.

Dim

cmdCommand

As ADODB.Command

Set

cmdCommand

= New ADODB.Command

After a new Connection object is instantiated, you can assign it to an open connection and call the Execute method to execute a SQL statement, query, or stored procedure against the data source. This concept will be illustrated in more detail later in this chapter when you create SQL statements and use ADO to execute them. In addition, the comprehensive case study in Chapter 13 that deals with SQL Server will illustrate how to use the Command object to pass parameters to SQL Server stored procedures.

0 0

Post a comment