The information in this article applies to:
SUMMARYThis article describes how to handle errors in DTS Package and Step objects by using the GetExecutionErrorInfo method call, OnError event and Visual Basic Err object. MORE INFORMATIONSQL Server 7.0 CD has a Visual Basic sample in devtools\Samples\DTS\dtsexmp3 folder with an example of error handling (given in the following) for a Step.
However, the earlier code has a bug where calling GetExecutionErrorInfo (lpErrorCode) method does not populate lpErrorCode with error code information. It should not enclose the parameter in parenthesis since it is called by Reference. The following call will populate the error code correctly:
A better way to retrieve error information is to include additional (optional) parameters to GetExecutionErrorInfocall, as given in the following:
Step object failure is separate from Package object failure. Therefore, error information for each step is unavailable from the COM IErrorInfo object or the Visual Basic Err object.GetExecutionErrorInfo method does not return detailed error description in SQL Server 7.0. In order to get additional error information, you should also implement event handlers in your code and check for error description inside OnError event. For example:
For additional information about how to handle DTS error events, please click the article number below
to view the article in the Microsoft Knowledge Base:
Q221193 INF: How To Install DTS Event Handlers In Visual BasicYou should also check Visual Basic Err object for DTS package errors. For example:
Note that some error details may not be available.
In addition, using SQL Enterprise Manager UI, the following options on DTS Package properties, General tab let you control the error handling:Error file Specify the file to which package run-time errors are logged (the DTS Package.LogFileName property). This can be in UNC format. (...) Locate and specify the log file. Fail package on first error Specify whether package execution terminates if the first step fails. Write completion status to event log Specify whether to write the package execution status to the Windows NT application log. This option is available only on computers running Windows NT. Using the object model, DTSErrorMode (package constant) specifies error modes for DTS package execution.
Note that when a DTS package step fails, the Error file and Windows NT Event log do not provide detailed information on why it has failed, even though DTS Wizard and Designer UI displays the full error in a message box.
Additional query words:
Keywords : kbSQLServ700 kbDSupport kbinfo |
Last Reviewed: February 2, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |