Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Invoking and Passing variable value in SSIS from C#

$
0
0

Problem => The value passed to SSIS variable from C# code is not picked up by SSIS. I have an SSIS pkg, which use user defined variable x of type int, with default value of 3. When executing the pkg from C# and assigning value 7 to x. The SSIS pkg not picking the new value for x and using value 3.

Code =>

  string pkgLocation = @"D:\DCS\Narendra\Min Extract\MinExtract Solution\MinExtract Project\test.dtsx";
            Package pkg;
            Application app;
            DTSExecResult pkgResults;
            Variables vars;

            app = new Application();
            pkg = app.LoadPackage(pkgLocation, null);

            vars = pkg.Variables;
            vars["UptoSeries"].Value = 7;
           
            pkgResults = pkg.Execute(null, vars, null, null, null);
           
            if (pkgResults == DTSExecResult.Success)
                Console.WriteLine("Package ran successfully");
            else
                Console.WriteLine("Package failed");

Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>