Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 import/export + global variables

Author  Topic 

gardan
Starting Member

1 Post

Posted - 2006-07-22 : 11:16:21
Hi all,

I need execute DTS package using DTSTransferObjectsTask with parameter or global variable from Visual Basic 6 and set this parameter to task.DestinationPassword.

I have already defined global variable:

Dim oGlobal As DTS.GlobalVariable
Set oGlobal = goPackage.GlobalVariables.New("password")
oGlobal = "defaultpass"
goPackage.GlobalVariables.Add oGlobal
set oGlobal = Nothing

and set it to DestinationPassword:

oCustomTask1.DestinationPassword = goPackage.GlobalVariables.Item("password").Value

but it always use "defaultpass" insted of value I have defined in VB source ("mypass") which execute this package:

Dim objPackage As New Package
objPackage.LoadFromSQLServer "localhost", , , _
DTSSQLStgFlag_UseTrustedConnection, , , , "DTSpackage"
objPackage.GlobalVariables.Item("password").Value = "mypass"
objPackage.Execute
objPackage.UnInitialize

Thanks for comments/help

Gardan

p.s. Script has been generated using "import/export wizard", so i guess problem is on lines above.
   

- Advertisement -