My SP takes 5 minutes to execute until finished. I need the sp when it finishes executing only at that moment I return to another view.
my code :
public ActionResult EXEC_SSIS()
{
string constr = ConfigurationManager.ConnectionStrings["Constring"].ConnectionString;
SqlConnection cn = new SqlConnection(constr);
SqlCommand ExecJob = new SqlCommand();
ExecJob.CommandType = CommandType.StoredProcedure;
ExecJob.CommandText = "msdb.dbo.sp_start_job";
ExecJob.Parameters.AddWithValue("@job_name", "test");
ExecJob.Connection = cn;
using (cn)
{
cn.Open();
using (ExecJob)
{
ExecJob.ExecuteNonQuery();
}
}
return Redirect("/AS/Result");
}