Last active
August 29, 2015 14:25
-
-
Save joymon/12cb4a537b94fb18c119 to your computer and use it in GitHub Desktop.
Invoke SSIS With Parameters & Variables set
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal void TestExecutionInstanceId() | |
{ | |
Package pkg = GetPackageFromConstantLocationWithParametersSet(); | |
DTSExecResult pkgResults = pkg.Execute(); | |
object executionIdAsObj = pkg.Variables["System::ExecutionInstanceGUID"].Value; | |
Guid executionId = Guid.Parse(executionIdAsObj.ToString()); | |
Console.WriteLine(pkgResults.ToString()); | |
} | |
private static Package GetPackageFromConstantLocationWithParametersSet() | |
{ | |
string pkgLocation = @"..\Package.dtsx"; //Location to dtsx package | |
Package pkg = GetLoadedPackageWithParametersSet(pkgLocation); | |
return pkg; | |
} | |
private static Package GetLoadedPackageWithParametersSet(string pkgLocation) | |
{ | |
Application app = new Application(); | |
Package pkg = app.LoadPackage(pkgLocation, null); | |
AddParametersIntoPackage(pkg); | |
return pkg; | |
} | |
private static void AddParametersIntoPackage(Package pkg) | |
{ | |
pkg.Parameters["number"].Value = 3; | |
pkg.Variables["counter"].Value = 10; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment