sql server job agent sharepoint webpart
-
Friday, April 13, 2012 3:36 PM
Hi,
I want to run a sql server job agent on button click of sharepoint visual webpart. Can anyone suggest me how to do this?
Anusha
All Replies
-
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'"
http://msdn.microsoft.com/nb-no/library/ms186757(v=SQL.100).aspx
http://msdn.microsoft.com/nb-no/library/ms188283(v=sql.100).aspx
- Marked As Answer by Shimin Huang Friday, April 20, 2012 5:34 AM

