Hi,
Is is it possible to check if SQL Server Agent is running and if it is not running start it to schedule tasks from MFC app in VC++.net
Any help is highly apprecited!
Thankx
Printable View
Hi,
Is is it possible to check if SQL Server Agent is running and if it is not running start it to schedule tasks from MFC app in VC++.net
Any help is highly apprecited!
Thankx
U can use SQL-DMO methods .
Best regards,
Krzemo.
JobServer Object
The JobServer object exposes attributes associated with SQL Server Agent. SQL Server Agent is responsible for executing scheduled jobs and notifying operators of Microsoft® SQL Server™ 2000 error conditions or other SQL Server execution or job states.
[img]mk:@MSITStore:C:Program%20FilesMicrosoft%20SQL%20Server80ToolsBookssqldmo.chm::/dmor01.gif[/img] http://forums.codeguru.com/Properties
AutoStart PropertyStatus Property (Services)MSXServerName PropertyType Property (JobServer)StartupAccount Property
http://forums.codeguru.com/Methods
BeginAlter MethodReAssignJobsByLogin MethodCancelAlter MethodRefresh MethodDoAlter MethodRemoveJobByID MethodEnumJobHistory MethodRemoveJobsByLogin MethodEnumJobs MethodRemoveJobsByServer MethodEnumSubSystems MethodStart Method (FullTextService, JobServer)GetJobByID MethodStartMonitor MethodMSXDefect MethodStop MethodMSXEnlist MethodStopMonitor MethodPurgeJobHistory Method
Remarks
With the JobServer object, you can:
- Start or stop SQL Server Agent on a server running SQL Server.
- Manage alerts, jobs, and operators.
- Enlist the server in a multiserver administration group.
[img]mk:@MSITStore:C:Program%20FilesMicrosoft%20SQL%20Server80ToolsBookssqldmo.chm::/Basics/note.gif[/img] Note The JobServer object is compatible with instances of SQL Server 2000 and SQL Server version 7.0. However, the JobServer2 object extends the functionality of the JobServer object for use with features that are new in SQL Server 2000.
(SQL Books Online)
Best regards,
Krzemo.
thanks a lot for the guidance, I will look into it.
Meanwhile I have tried the approach that SQL ServerAgent is just another service on windows and tried win api functions for the purpose of querying the status of the service and staerting it.
But no success till now because the server is Onn LAN and I can't find a way to make it work.
OpenSCManager accepts the server name if the computer is remote. but it returns RPC server not available.
I will try both approaches and see hat happens.
Thanks again
Well the Links ove r there don't work!!!!
It was just a copy of CHM help (SQL Server Books Online) from local computer.
It was'nt suppose to work.
But I found an article (over Internet) that fully covers UR problem.
http://msdn.microsoft.com/library/de...asp?frame=true
And that link works :)
Best regards,
Krzemo
thnks dude am trying to find out what i need to include in c++ in order to make that work