Friday, April 13, 2012 3:36 PM
I want to run a sql server job agent on button click of sharepoint visual webpart. Can anyone suggest me how to do this?
Friday, April 13, 2012 3:44 PMWrite a SQL Query to run the JOB, use ADO .NET to connect to the SQL Server and execute your query.
Rahul Gupta, MCPD - SharePoint 2010
Friday, April 13, 2012 5:59 PMModerator
Depending on if the executing account has the necessary permissions to run SQL Server Agent jobs, you can connect to the database and run the job by executing the sp_start_job stored procedure as follows: "EXEC MSDB.dbo.sp_start_job @job_name= 'YourJobName'"
- Marked As Answer by Shimin Huang Friday, April 20, 2012 5:34 AM