I have created a windows application that triggers a SQL job to start on the SQL Server. This is how I have written the code to trigger the job.
SqlCommand ExecJob = new SqlCommand();
ExecJob.Connection = sqlConn;
ExecJob.CommandType = CommandType.StoredProcedure;
ExecJob.CommandText = "msdb.dbo.sp_start_job";
ExecJob.Parameters.AddWithValue("@job_name", "DataImport");
sqlConn.Open();
ExecJob.ExecuteNonQuery();
It runs fine and completes in about 40 seconds. I do not want to enable some certain functions in my program until this job is completed successfully. Does anyone know how I can do this?