Execute a SQL Job from C#

A

Alberto Poblacion

Dave said:
How can I execute a SQL Server 2005 Job from C# in an ASP Page?

If you are using C#, I assume that you mean an ASP.NET Page, rather than
a legacy ASP Page, even though the procedure to execute a Job is similar in
both cases.
Open a SqlConnection to the server. Create a SqlCommand and configure it
to execute the stored procedure sp_start_job with the relevant parameters to
specify your job (described in the Sql Server Books On Line). Use
ExecuteNonQuery to execute your SqlCommand, and Close the connection.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top