What exactly do you want to achieve by executing a job from C#? A job is basically just a method of packaging up something to run - and you could run it more directly using the inbuilt classes in the SqlClient namespace if you were running it through code directly. So - why do you want to execute a job from code?
answered Oct 18 '10 at 07:23 AM
Matt Whitfield ♦♦
I have used the exec [msdb].dbo.sp_update_jobstep to dynamically change the Job step in my stored procedure.This enable me to change the parameter in the job step as well. In my case I am using a package in the Job step, I can set the package variable
I would rather call the package directly from my c# code using Microsoft.SqlServer.Dts.Runtime.Unfortunately these ssis objects are not available in my webserver.I was only allowed to call a stored procedure through a web service.Hence I ended up with this method :(
Thank You, Kannan
answered Oct 19 '10 at 07:53 AM