I created SSIS package using integration service project in vs 2015.
My connection establishment is successful using Datasource. I can execute package using Execute Package Utility and Command line which is successful.
Please check below screens shots for the same.
I am facing problem while executing same package using c#. getting failed to execute package.
I have applied eventlistener, getting below error.
Please find below few screenshots for more information.

Code for reference:
Application app = new Application();
Package pkg = app.LoadPackage(@"C:\Project\Sample\Package1.dtsx", listener);
DTSExecResult results = pkg.Execute(null, null, listener, null, null);
In results object i got failure with given error.
As @Tab Alleman says you can run the package by calling a stored procedure sp_start_job from C# that starts SQL Agent JOB.
Here a piece of code that can be of help in this type of approach, after creating the SQL Agent JOB:
SqlConnection Conn = new SqlConnection(YOURCONNECTION);
SqlCommand ExecuteJob = new SqlCommand();
ExecuteJob.CommandType = CommandType.StoredProcedure;
ExecuteJob.CommandText = "msdb.dbo.sp_start_job";
ExecuteJob.Parameters.AddWithValue("@job_name", YOURJOBNAME")
ExecuteJob.Connection = Conn;
using (Conn)
{
Conn.Open();
using (ExecuteJob)
{
ExecuteJob.ExecuteNonQuery();
}
}
I hope this help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With