I'm trying to run a ms sql server agent job from within my vb.net code using sp_start_job and getting exception...
Could not find stored procedure 'sp_start_job'.
... so obviously I'm doing something wrong. My vb code contains is ...
jobCommand = New SqlCommand("sp_start_job", sqlConn)
jobCommand.CommandType = CommandType.StoredProcedure
jobParameter = New SqlParameter("@job_name", SqlDbType.VarChar)
jobParameter.Direction = ParameterDirection.Input
jobCommand.Parameters.Add(jobParameter)
jobParameter.Value = "nameOfServerAgentJob"
jobCommand.ExecuteNonQuery()
Can someone show me how to run the SQL Server Agent job properly from my vb code?
Thanks tonnes for any help, Roscoe