none
Wait a Job to finish

    Question

  • 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");
    }

    • Moved by CoolDadTx Wednesday, May 8, 2019 5:32 PM ASP.NET related
    Wednesday, May 8, 2019 2:43 PM

All replies