Thursday, 29 January 2015

Executing SSIS Package by using C# windows application

Sometimes we need to call/execute an SSIS Package through a C# application. This is just a small example for how we can Call/Execute an SSIS Package through a C# windows application.
Here I am going to create a package. I took Script task and want to display simple message through it.
Step by step calling SSIS package in C# application 

I have written simple message in script.


Save and click ok.
Now execute package.

Task Executed successfully.
Now we need to deploy the package. Right click on Solution explorer and select properties.

Select Deployment Utility form the Configuration Properties and select CreateDeploymentUtility as True.

Click apply and ok.
Now build the application. Deployment file has been created on bin\deployment.

Package has been created successfully.
Now we can call this package in c# application (Windows, web or console)
Open Visual Studio 2012.
Select Fileà New àProject.

Write the project name and select the project folder path.

Click ok.
Take a button on windows form.

Double click on it.

Before writing the c# code we need to add a Microsoft.SQLServer.ManagedDTS.dll in the reference.

We will do not get this dll in .net assembly. You can get this assembly on below path
C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies”.

Click on the Add Reference.
Write the simple code in button click.
private void button1_Click(object sender, EventArgs e)
        {

Microsoft.SqlServer.Dts.Runtime.Application myApplication = new Microsoft.SqlServer.Dts.Runtime.Application();                
Package myPackage = myApplication.LoadPackage(@"F:\SSIS test\
SSISPackegedemoToCallin.net\SSISPackegedemoToCallin.net\bin\Deployment
\Package.dtsx", null);
lblStatus.Text = "Executing package";
DTSExecResult myResult = myPackage.Execute();
// Show the execution result
lblStatus.Text = "Package result: " + myResult.ToString();
        }

Now compile the code and execute it.

Click button.


Package executed successfully.
Enjoy hope this post will be helpful to you. Shortly I will post how to call parameterizes package and how to call store procedure.



2 comments:

  1. hello little bit problem in program can you help me

    ReplyDelete
  2. Microsoft Business Intelligence: Executing Ssis Package By Using C Windows Application >>>>> Download Now

    >>>>> Download Full

    Microsoft Business Intelligence: Executing Ssis Package By Using C Windows Application >>>>> Download LINK

    >>>>> Download Now

    Microsoft Business Intelligence: Executing Ssis Package By Using C Windows Application >>>>> Download Full

    >>>>> Download LINK NL

    ReplyDelete

If you have any doubt, please let me know.

Popular Posts