ADO WillExecute and ExecuteComplete events

Definition and Usage

The event is an automatically called subroutine after a specific operation occurs.

  • The WillExecute event is triggered before calling objcomm.Execute, objconn.Execute, or objrs.Open
  • The ExecuteComplete event is triggered after the call to objcomm.Execute, objconn.Execute, objrs.Open, objrs.Requery, or objrs.NextRecordset is completed

Syntax

WillExecute src,cursortyp,locktyp,options,status,objcomm,objrs,objconn
ExecuteComplete refactored,objerror,status,objcomm,objrs,objconn
parameter Beskrivelse
src a string containing the SQL command or stored procedure name.
cursortyp specifies the cursor type to be used.CursorTypeEnum one of the values.
locktyp specifies the locking type to be used.LockTypeEnum one of the values.
options one or more CommandTypeEnum or ExecuteOptionEnum Værdi
reaffected Long value, the number of records affected by the command.
objerror Contains the Error object with the errors that have occurred.

Note: The EventStatusEnum value must be set to adStatusErrorsOccurred to create this Error object.

status one EventStatusEnum value.
objcomm

For WillExecute: If this event is triggered by Command.Execute, the objcomm parameter will refer to the Command object, and the objrs parameter will be set to Nothing.

For ExecuteComplete: The executed Command object.

objrs

For WillExecute: Hvis denne begivenhed udløses af Recordset.Open, vil objrs parameteren referere til Recordset objektet, og pCommand parameteren vil blive sat til Nothing.

For ExecuteComplete: Recordset objektet, er resultatet af kommandoeksekveringen.

objconn Connection objektet, der er forbundet med kommandoeksekvering.

EventStatusEnum værdier

Konstanter Værdi Beskrivelse
adStatusOK 1 Handlingen, der udløste denne begivenhed, var succesfuld.
adStatusErrorsOccurred 2 Handlingen, der udløste denne begivenhed, mislykkedes.
adStatusCantDeny 3 Det er ikke muligt at annullere en afventende handling.
adStatusCancel 4 Annuller handlingen, der forårsagede begivenheden.
adStatusUnwantedEvent 5 Forbyd yderligere notifikationer, før eventmetoden udføres.