Step 3: Execute the Command (ADO Tutorial)

See Also   

You are Here...

Discussion

The three methods that return a Recordset are Connection.Execute, Command.Execute, and Recordset.Open. This is their syntax in Visual Basic:

connection.Execute(CommandText, RecordsAffected, Options)
command.Execute(RecordsAffected, Parameters, Options)
recordset.Open Source, ActiveConnection, CursorType, LockType, Options

These methods are optimized to take advantage of the strengths of their particular objects.

Before you issue a command, you must open a connection. Each method that issues a command represents the connection differently:

Another difference is the way the command is specified in the three methods:

Each method trades off functionality versus performance:

This tutorial uses a dynamic cursor to batch any changes to the Recordset. For this reason, use the following:

Recordset rs = New ADODB.Recordset
rs.Open cmd, conn, adOpenDymanic, adLockBatchOptimistic

Next   Step 4