OnQueryCancel Event

DTS Programming

DTS Programming

OnQueryCancel Event

The OnQueryCancel event terminates tasks. A Data Transformation Services (DTS) package raises this event only when it is safe to stop execution of the task. The event handler determines whether task execution should be terminated.

Applies To
Package Object Package2 Object
Syntax (Visual Basic)

Sub objPackage_OnQueryCancel(ByVal EventSource As String, _
    ByVal pbCancel As Boolean)

Part Description
objPackage Object variable of a type specified in the Applies To list.
EventSource Source of event being executed (for example, a step name).
pbCancel Boolean that specifies whether to cancel task execution.

Remarks

If pbCancel is set to TRUE by the event handler, DTS stops task execution and fails with error. This event may not occur if execution of the step or task completes quickly.

For task types defined by DTS, the EventSource argument specifies a step name. Custom tasks choose what to return for EventSource. When an event is not caused by or associated with a step, the EventSource argument is empty.

If you need to raise this event from a custom task implemented in Microsoft® Visual Basic®, use this syntax:

pPackageEvents.OnQueryCancel EventSource, pbCancel

pPackageEvents is a reference to the package events object, passed in as a parameter of the custom task Execute method that you have implemented. When the event returns, terminate task execution if pbCancel is TRUE.

Prototype (C/C++)

HRESULT OnQueryCancel(BSTR EventSource,
BOOL *pbCancel);

See Also

Execute Method

Handling DTS Events and Errors

KILL