C# and SQL Server Integration services
Hello,
I am trying to figure out the code in c sharp to execute an ssis package. I have code for a console application that will run as shown below. But I am looking for code that will execute a Windows Form Application Button.
Ex.
Click a button on a windows forms app and it will execute a specified package.
This is the console application for executing a package from a specified directory.
***************************************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace ExecPkg
{
class Program
{
static void Main(string[] args)
{
string pkgLocation;
Package pkg;
Application app;
DTSExecResult pkgResults;
pkgLocation = @"C:\TestPackage.dtsx";
app = new Application();
pkg = app.LoadPackage(pkgLocation, null);
pkgResults = pkg.Execute();
Console.WriteLine("Package has been successfully executed.\n\n" + "Package Results [" + pkgResults.ToString() + "]\n\nGoodbye!");
}
}
}
How do I convert this to windows form application code????
Please help ASAP.
Thank you.