Command Object

A Command object is best used to make changes to data - INSERT, UPDATE, or DELETE SQL statements.

First, set some properties of the Command object:

ActiveConnection The connection object
CommandText The SQL statement, a query name, or a table name
CommandType The form that the CommandText is in.

Then Execute method of the Command object has the three optional parameters. The second one is the most useful, as it will return a number indicating how many rows were affected by the SQL statement.

myCommand.Execute , intRowsAffected
Response.Write "Number of rows affected: " & intRowsAffected

Creating a Command object:

ASP Dim objCmd

Set objCmd = Server.CreateObject("ADODB.Command")

VB Dim objCmd as ADODB.Command

Set objCmd = New ADODB.Command

VB .Net Dim objCmd as New ADODB.Command