The Connection Execute Method

connection.Execute CommandText [, RecordsAffected] [, Options]

You can use the Execute method of the Connection object. Just instantiate a connection and issue its Execute method—it's that simple!

Dim cn As New ADODB.Connection

Dim lngRA As Long, lngOptions As Long lngOptions = adCmdUnspecified And adAsyncExecute cn.Open CurrentProject.Connection cn.Execute strSQL, lngRA, lngOptions

The CommandText argument can be an SQL statement: the name of a table, the name of a stored procedure, or a provider-specific text or command. The RecordsAffected argument, if supplied, is populated with the number of records affected by the operation, when the operation completes.

The Options argument can be a combination of the CommandTypeEnum values or

ExecuteOptionEnum values that affect the way the Execute method works. Appendix J contains a list of all the available CommandTypeEnum and ExecuteOptionEnum values.

0 0

Post a comment