Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using Script Task in SSIS to consume WCF Service which has custom binding,included the config information under DtsDebugHost.exe.config as i have no other option,till here it is fine,now i need to call the SSIS package from c# which i am not able to do.
Posted

Add following reference in your project - Microsoft.SqlServer.ManagedDTS
And in namespace add using Microsoft.SqlServer.Dts.Runtime;

protected void btn_get_Click(object sender, EventArgs e)
{
Microsoft.SqlServer.Dts.Runtime.Application MyApp = new Application();
MyApp.PackagePassword = "abcd"; //if SSIS package is procted by password.
Package Mypac = MyApp.LoadPackage(@"<ssis package="" path="">", null);
DTSExecResult Myres = Mypac.Execute();
//This is to find exact error while executing SSIS package.
if (Myres == Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure)
{
string err = "";
foreach (Microsoft.SqlServer.Dts.Runtime.DtsError local_DtsError in Mypac.Errors)
{
string error = local_DtsError.Description.ToString();
err = err + error;
}
txt_result.Text = err.ToString();
}
}

Hope this may help you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900