Execute a SSIS master package through an ASP.NET web app

I am trying to execute a SSIS package via a web application built in c#.  I found a sample to read the output of a data flow task, but I'm stuck.  If I build the command line syntax for the package, create a DtsConnection object and set the connection string to the syntax, what else do I need to do   Thanks.

Clay


Answer this question

Execute a SSIS master package through an ASP.NET web app

  • im4nits

    Well, the critical step is to create a DtsCommand whose CommandText = the name of the DataReader Destination in the package, then to execute that command to retrieve the DataReader [contents].

    Does your BOL version have our topic, "Loading Data Flow Results into a Client Application "

    -Doug

  • rdelgado

    I do have that topic.  Rather than loading the data flow results into the web app, can I just simply kick off the package as I would through the package utility
  • CS Chan

    You can use the object model to manipulate the package and its components to any degree that your heart desires, from the minimum shown above (load and run) to the hardcore extreme of building every single task and property one line of code at a time. However you'll probably want to start somewhere in the middle with a package, maybe a kind of "template" package, in which you tweak only what you need for a particular execution.

    -Doug

  • Mekk Elek

    If you don't have that topic in your BOL build, you can find it temporarily at http://msdn2.microsoft.com/en-us/library/ms135917(en-US,SQL.90).aspx.

    Note that this is an MSDN temporary staging location, before they publish the September CTP BOL to the live MSDN site, so this link may be invalid by tomorrow...please don't bother saving or redistributing it. All of the September BOL will be available shortly on http://msdn.microsoft.com.

    -Doug

  • HarryChou

    Excellent!  I can open the package and return a result which currently is failed.  Can I assign variables from here as well


  • Neetan

    The Variables collection is read only.  How do I set a variable called "myVar" to "test"
  • Marcus Alexandre

    Thanks for your help!


  • Mike Frazer

    Sure, that's the BOL topic currently named "Running an Existing Package from a Client Application." It's basically just Load and Execute (as in DTS). Here's the VB sample from that topic (as a console app).

    -Doug

    Imports Microsoft.SqlServer.Dts.Runtime

    Module Module1

      Sub Main()

        Dim pkgLocation As String
        Dim pkg As New Package
        Dim app As New Application
        Dim pkgResults As DTSExecResult

        pkgLocation = _
          "C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx"
        pkg = app.LoadPackage(pkgLocation, Nothing)
        pkgResults = pkg.Execute()

        Console.WriteLine(pkgResults.ToString())
        Console.ReadKey()

      End Sub

    End Module


  • Wa1d0

    A call to the Variables collection with an index or name will return a Variable object. You modify its Value property.


  • Sandeepn75

    Thanks for all your help!  I am trying to set variables as we speak.


  • Execute a SSIS master package through an ASP.NET web app