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)
 DTS LoadFromSQLServer - encrypted package problem

Author  Topic 

M.Thelian
Starting Member

2 Posts

Posted - 2002-07-19 : 03:54:55
Hi!

I try to modify a list of DTS-Packages within a 'ActiveX Script
Task' of an DTS-Package.
Here is my sourcecode:

--------------
dim sPkgName

Function Main()

dim RS, countr
'the recordset that contains the packagename-list
set RS = CreateObject("ADODB.Recordset")
set RS = DTSGlobalVariables("DTS_Names").value

for countr = 1 to RS.RecordCount
sPkgName = RS.Fields("name").value
Modify_Package()
RS.MoveNext
Next

Main = DTSTaskExecResult_Success
End Function


Function Modify_Package()

Dim oPkg, sServer, sUID, sPWD, oConnection, iSecurity , sPkgPWD

Set oPkg = CreateObject("DTS.Package")
Set sServer = "servername"
Set sUID = "yyy"
Set sPWD = "yyy"
Set iSecurity = DTSSQLStgFlag_Default
Set sPkgPWD = ""

On Error Resume Next

' Load Package
oPkg.LoadFromSQLServer sServer, sUID, sPWD, iSecurity , _
sPkgPWD, "", "", sPkgName

If (Err.Number <> 0) Then
MsgBox ("Errormessage: " & Err.Description & _
" Errorcode: " & Err.Number)
Err.Clear
exit function
else
' Examine Connections
For Each oConnection in oPkg.Connections

If (oConnection.DataSource="DataSourceToReplace") then
oConnection.DataSource = "newDataSource"
'save modified package
oPkg.SaveToSQLServer sServer, sUID, sPWD
End If
Next
end if

Set oConnection = Nothing
Set oPkg = Nothing

End Function
--------------

The problem is, that if I try to load an encrypted package, I get the
errormessage: "Cannot load encrypted package without a password." with
the errorcode: -2147220454. That's ok, but for the next packages in
the packagelist I get the errormessage: "" with the same errorcode,
even if the packages are not enrypted and could be loaded without a
password.

What can I do?

I'm using the MS-SQL Server Standard Edition, Version 7.00.961

Martin


Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-07-19 : 11:30:21
In your for loop, tell it to skip the encrypted package(s).

<O>
Go to Top of Page

M.Thelian
Starting Member

2 Posts

Posted - 2002-07-22 : 02:23:46
> In your for loop, tell it to skip the encrypted package(s).

How can I find out if a package is encrypted?

Go to Top of Page
   

- Advertisement -