Wednesday, March 7, 2012

Error in executing a DTS Package from Visual Basic

Hi! Good Day!

I am executing a DTS PAckage from Visual Basic. My code is this:

objPackage.LoadFromSQLServer "SERVER", , , _
DTSSQLStgFlag_UseTrustedConnection, , , , "DTSPackage1"
objPackage.Execute

objPackage.LoadFromSQLServer "SERVER", , , _
DTSSQLStgFlag_UseTrustedConnection, , , , "DTSPackage2"
objPackage.Execute

The first DTS package was executed successfully, but when it hit the second package, an error occurs:

Step 'DTSStep_DTSDataPumpTask_1' already exists in the collection.

Please help.
Thanks.hi

try this

dim objPackage as DTS.Package

set objPackage = new DTS.Package
objPackage.LoadFromSQLServer "SERVER", , , _
DTSSQLStgFlag_UseTrustedConnection, , , , "DTSPackage1"
objPackage.Execute

set objPackage = nothing

set objPackage = new DTS.Package

objPackage.LoadFromSQLServer "SERVER", , , _
DTSSQLStgFlag_UseTrustedConnection, , , , "DTSPackage2"
objPackage.Execute

hope this will solve the problem|||Hi baburajv,

My DTS packages are working well now.
Thank you so much for your help.

God bless :)

No comments:

Post a Comment