Click to See Complete Forum and Search --> : DTS


anita
October 16th, 2001, 11:52 PM
I created a DTS package in SQL Server 2000 and saved it as a VB file (.bas). It runs fine in VB (a table is copied from one database to another).

There is no error handling code in the package. I am wondering whether I should add error handling. I saw an example in MSDN and tried to implement it in my package. I used OnError GoTo DTSPackageErr and coded my error handler. I set the FailOnError property to true. I changed the database name to some non-existent name and ran my code. It ran fine, the database table was copied and no error was generated.

Does anyone have an example of error handling in a DTS package. Thanks!

spkrish
November 3rd, 2001, 09:57 PM
First all, i would like to know about your DTS package can you explain me please....?

Thank u in advance
spkrish

anita
November 5th, 2001, 09:13 AM
I created the package in SQLServer import/export wizard, saving it as a .bas file. Then I added it to my VB project. Essentially, I have the identical table structure in two different SQL Server databases. The user only updates one of the tables. The VB program compares the table data and if different, calls the DTS package code to then copy one table to the other.

I wanted to add error handling in case the copy didn't complete or the power went out. Am looking for info on error handling in DTS.

Thanks for your help.

chilakamati
January 9th, 2002, 06:39 AM
If ur using the same bas file as it is it is not possible. Instead u generalize the code and move it into a form then it is possible.

Here is the Example

in the module the code will be like this

Public goPackageOld As New DTS.Package
.....

Now when u move this code to form it will be like

Public WithEvents goPackageOld As DTS.Package
--

and in form load event create new instance of the object. Now u can see goPackageOld_OnError event in the form. now u can trap the errors.

If this is serving ur purpose then Cheers else let me see other angle of the problem from u.

Cheers and HAPPY NEW YEAR.

chilakamati at yahoo