Amend DTS Package with VB -
02-05-2004
, 10:17 PM
I've got a server on which I need to update the connection
on all the DTS packages.
I can connect and get a list of the packages but I'm stuck
on getting each package. On the
step "myPkg.LoadFromSQLServer ServerName = "WNCHASQ02DE",
DTSSQLStgFlag_UseTrustedConnection, PackageName = pkgname
"
I receive an error that "Access is Denied or the Server
does not exist"... which is obviously odd because I've
already proven I can connect to the server when I
retrieved all the packages in the enumpackageinfos step.
I've tried using both trusted and SQL connections but it's
the same either way.
I'm at a loss! If anyone has any ideas I'd love to hear
them!
Code is below.
Set oDTSApp = New DTS.Application
Set oGetPkg = oDTSApp.GetPackageSQLServer
("WNCHASQ02DE", "", "", 256)
Set cPkgs = oGetPkg.EnumPackageInfos("",
True, "") 'EnumPackageInfos
(PackageName,ReturnLatest,PackageID )
For Each oPkg In cPkgs
pkgname = oPkg.Name
Set myPkg = New DTS.Package
'myPkg.LoadFromSQLServer "WNCHASQ02DE", "DTSUser", "DTS
User", DTSSQLStgFlag_Default, "", "", "", pkgname
myPkg.LoadFromSQLServer ServerName = "WNCHASQ02DE",
DTSSQLStgFlag_UseTrustedConnection, PackageName = pkgname
Set cConns = myPkg.Connections
For Each oConn In cConns
If oConn.ConnectionProperties("Data Source")
= "WNCHASQ02" Then
oConn.ConnectionProperties("Data Source")
= "(local)"
Debug.Print myPkg.Name & ": " & oConn.Name
End If
Next
Next oPkg |