January 9, 2006 at 5:25 am
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.
January 10, 2006 at 9:27 am
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);
}
}
December 11, 2007 at 2:47 am
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
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy