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!

DTS PAckage

Status
Not open for further replies.

jockey

Programmer
Nov 18, 2003
34
GB
HOw can I execute a DTS package from within A vb application
 
This has been covered many times . . .
but here goes:
Reference: dtspkg.dll

Dim objPackage As DTS.Package2

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

'Set the server/username/password and the DTS package to be run
objPackage.LoadFromSQLServer ServerName, UserName, Password, DTSSQLStgFlag_Default, "", "", "", "DTS_Name"

'Pass the Global variables - date values to the DTS Package
objPackage.GlobalVariables("FromDate").Value = dtpFrom.Value
objPackage.GlobalVariables("ToDate").Value = dtpTo.Value

'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 you find this useful.
[flowerface]

I was standing in the park, wondering why frisbees got bigger as they came closer... then it hit me!
 
Cheers mate most helpfull

Dont suppose u know anything about stored procedures do u??
 
What about them?
>Dont suppose u know anything about stored procedures do u??

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