WillExecute (ConnectionEvent) Method (ADO)

See Also   Applies To

This method is called just before a pending command executes on this connection and affords the user an opportunity to examine and modify the pending execution parameters. This method may return a request that the pending command be canceled.

Syntax

WillExecute Source, CursorType, LockType, Options, adStatus, pCommand, pRecordset, pConnection

Parameters

Source   A String containing an SQL command or a stored procedure name.

CursorType   A CursorTypeEnum containing the type of cursor for the recordset that will be opened. This parameter cannot be changed if it is set to adOpenUnspecified when this method is called.

LockType   A LockTypeEnum containing the lock type for the recordset that will be opened. This parameter cannot be changed if it is set to adLockUnspecified when this method is called.

Options   A Long value of options that can be used to execute the command or open the recordset.

adStatus   An EventStatusEnum status value that may be adStatusCantDeny or adStatusOK when this method is called. If it is adStatusCantDeny, this method may not request cancellation of the pending operation.

Before this method returns, set this parameter to adStatusUnwantedEvent to prevent subsequent notifications, or adStatusCancel to request cancellation of the operation that caused this event.

pCommand   The Command object for which this event notification applies.

pRecordset   The Recordset object for which this event notification applies.

pConnection   The Connection object for which this event notification applies.

Remarks

A WillExecute event may occur due to Connection.Execute, Command.Execute, or Recordset.Open. The corresponding pConnection, pCommand, or pRecordset parameter will be set to the object causing the event and the remaining two will be set to Nothing.