A custom task raises package events that are handled by the parent application. Typically, it raises the following events.
Event | Purpose | Frequency |
---|---|---|
OnError | To notify the parent application that an error has occurred, especially non-fatal errors. | When an error occurs. |
OnProgress | To notify the parent application of progress in task processing. | Every time a few units (for example, rows) process, or every few seconds. |
OnQueryCancel | To give the parent application the opportunity to terminate the custom task. In Data Transformation Services (DTS) Designer, click Cancel to handle this event. | Every few seconds. |
Note In DTS, you do not need to raise OnStart or OnFinish because each DTS step raises OnStart when it starts and OnFinish when it finishes.
OnQueryCancel and OnError have a pbCancel parameter. If the handling application sets pbCancel, the custom task should terminate execution by returning from the CustomTask_Execute method.
One of the parameters of CustomTask_Execute is a reference through which package events can be raised. Check for NULL or Nothing (depending on programming language) before using it.