How can I execute a package with a package password in SSIS through code?

I am trying to call an SSIS package through C # code. The package worked before I included the package password, but now I am trying to provide a password. I get an error that the password is incorrect or not specified.

Package package = app.LoadPackage("mypackage.dtsx, null); package.PackagePassword = "mypass"; DTSExecResult result = package.Execute(); 

Can someone please indicate where I am going wrong?

+1
source share
3 answers

I believe this is what you need:

 app.PackagePassword = "mypass"; 
+4
source

You must set a password before downloading the package, try the following:

 Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application(); app.PackagePassword = "mypass"; Package package = app.LoadPackage("mypackage.dtsx, null"); 

This will work; -)

+2
source
 app.PackagePassword = "mypass"; Package package = app.LoadPackage("mypackage.dtsx, null); 
0
source

All Articles