Calling an IS package in C# ?

  • Could someone please point me at a simple example of how to execute a SSIS package from a c# application?

    I'm trying to upgrade an app that calls a DTS package to load the contents of a flat file into a database table and then call a few stored procs to manipulate the data...

    Thanks in advance.

     

  • There is a set of C# coding examples that come with the SSIS installation. I believe that you install them from the start menu after the initial SSIS install is complete. Would be worth looking into. Below is some sample code for executing a package that has been saved out to file.

    public ExecutePackage()

    {

     string packageFile;      // path to .dtsx package file

     PackageEvents packageEvents;     // class that implements the Package events interface IDTSEvents90

     ComponentEvents pipelineEvents;     // class that implements the component events interface IDTSComponentEvents90

     // Events

     packageEvents = new PackageEvents();

     pipelineEvents = new ComponentEvents();

     // Load package

     Application a = new Application();

     package = a.LoadPackage(packageFile,null);

     // Validate the layout of the package

     DTSExecResult status = package.Validate(null, null, packageEvents, null);

     // If the package validated successfully, then go ahead and execute it.

     if (status == DTSExecResult.Success)

     {

      //Execute the package

      DTSExecResult result = package.Execute(null, null, packageEvents, null, null);

     }

    }

  • can anybody provide complete code in c# how to execute ssis package in c#

    thanks in adavance..

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply