Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

execute .dts package from vb

Status
Not open for further replies.

kiwiCoder

Technical User
Aug 2, 2001
45
NZ
hoping someone can help me to execute a *.dts file from vb6. I have used a small vbp written by Josef Finsel called DTS Packager which creates a dtspackage that will recreate a database when run, it also copies data from all tables into .bcp files. i can't figure out how to execute the .dts file from vb.

If you love your job you never have to work again.
 
Dim objPackage As DTS.Package2
Dim sMessage As String

'Instanciate the DTS package object
Set objPackage = New DTS.Package2

'Set the server/username/password and the DTS package to be run
objPackage.LoadFromSQLServer strServer, strUserName, strPassword, DTSSQLStgFlag_Default, "", "", "", "Your package name"

'Set object to raise an error on failure and to do eventlogs
objPackage.FailOnError = True
objPackage.WriteCompletionStatusToNTEventLog = True

'Run DTS Package
objPackage.Execute
objPackage.UnInitialize

'Mark objects for garbage collection
Set objPackage = Nothing

Hope this helps.

[flowerface]

great reference link ...

I was standing in the park, wondering why frisbees got bigger as they came closer... then it hit me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top