Code to start a SSIS package

// Must add .NET reference to Microsoft.SQLServer.ManagedDTS
  
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;


class MySSISTest
{
   static void ExecutePackageFromFileSystem ()
   {
string MyPackage = @"c:\MyTestPackage";
      Application oApp = new Application();
      Package oPackage = 
               oApp.LoadPackage(MyPackage + ".DTSX", null);
oPackage.ImportConfigurationFile
            (MyPackage + ".dtsConfig");

Variables oVars = oPackage.Variables;
oVars["FileVariable"].Value = @"c:\SomeFile.CSV";
DTSExecResult oResult = oPackage.Execute();
   }


   static void ExecutePackageFromSQLServer()
   {
string MyPackage = "MyTestPackage";
      Application oApp = new Application();
      Package oPackage = 
               oApp.LoadFromSqlServer
                 (MyPackage, "localhost", "UserID", "PW", null);

oPackage.ImportConfigurationFile
            (@"c:\" + MyPackage + ".dtsConfig");

oVars["FileVariable"].Value = @"c:\SomeFile.CSV";
DTSExecResult oResult = oPackage.Execute();

   }

{{opmerking.Naam}}:

{{opmerking.OpmerkingText}}

            

Saving your comment....

Naam is verplicht!
Email is verplicht!
Opmerking is verplicht!