How to pass variables to an SSIS package from a C# application

前端 未结 2 2006
夕颜
夕颜 2020-12-29 10:51

Basically i am trying to build an application that uses SSIS to run a series of sql stuff.

Here is my code thus far:

        public JsonResult Fire         


        
相关标签:
2条回答
  • 2020-12-29 11:06

    Try that:

    Microsoft.SqlServer.Dts.RunTime.Variables myVars = package.Variables;
    
    myVars["MyVariable1"].Value = "value1";
    myVars["MyVariable2"].Value = "value2";
    
    Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute(null, myVars, null, null, null);
    
    0 讨论(0)
  • 2020-12-29 11:21

    You need to use the Package.Variables property.

            Package package = null;
            package = app.LoadPackage(@"C:\ft\Package.dtsx", null);
            package.Variables["User::varParam"].Value = "param value";
    
    0 讨论(0)
提交回复
热议问题