• Status: Solved
  • Priority: Medium
  • Security: Private
  • Views: 43
  • Last Modified:

How can I run ssis package from asp.net c#

How execute SSIS package (MYDTS.dtsx) from asp.net C#
Bharat Guru
Bharat Guru
1 Solution
Rikin ShahMicrosoft Dynamics CRM ConsultantCommented:

Try this sample code and change the values accoridngly!

using Microsoft.SqlServer.Dts.Runtime;

private void Execute_Package()
        string pkgLocation = @"c:\a.dtsx";

        Package pkg;
        Application app;
        DTSExecResult pkgResults;
        Variables vars;

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

        vars = pkg.Variables;
        vars["A_Variable"].Value = "Some value";               

        pkgResults = pkg.Execute(null, vars, null, null, null);

        if (pkgResults == DTSExecResult.Success)
            Console.WriteLine("Package ran successfully");
            Console.WriteLine("Package failed");

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now