MDAC 2.5 SDK - ADO


 

Step 2: Create a Command (ADO Tutorial)

See Also

You are Here...

Discussion

A command is an instruction understood by the data provider that will modify, manage, or manipulate the data source. Commands are typically written in SQL, although no particular command language is required. A query command requests that the data provider return a Recordset object containing rows of information.

Specify a command as either:

See the sidebar for a brief discussion of parameterized commands.

This tutorial queries for all the information in the Authors table of the Pubs database. The Command object is declared, set with the open Connection object, and the command text. The code looks like this:

Dim cmd As New ADODB.Command
Set cmd.ActiveConnection = cnn
cmd.CommandText = "SELECT * from Authors"

Next   Step 3: Execute the Command