views:

155

answers:

2

I need to create an application for monitoring SQL Server 2000 Agent Job status and info when Job occur same as show on Windows application event log. Now I connect to the database already via a connection string, but I don't know how to get the status and info from Job.

I need to show status and info on Textbox.

What do you suggestion how to do.

Developer tools :

  1. MS SQL Sever 2000 SP4
  2. MS Visual Studio 2008 (C#)

I am a rookie programmer.

Sorry for wasting people's time

A: 

This should be a good starting point to find out how to find your SQL Agent jobs using T-SQL:

View (and disable) SQL Agent Jobs with TSQL

The script will list out all your jobs on your database, and when they will be run next and so forth.

Using the job_name, you should also be able to find out details about your jobs using the SQL Server Agent Stored Procedures in the msdb database on your server.

marc_s
Alternatively, take a look at this MSDN page http://msdn.microsoft.com/en-us/library/aa260604%28v=SQL.80%29.aspx - specifically the SQL Server Agent Tables.
Will A
A: 

You can get a list of all server jobs using this SELECT:

SELECT [name] FROM msdb.dbo.sysjobs

If you'd like to get a list of currently running jobs and their information, I would recommend writing a stored procedure in SQL which your application calls. There's a good demonstration here you could use...

http://feodorgeorgiev.com/blog/2010/03/how-to-query-currently-running-sql-server-agent-jobs/

Good luck!

timothyclifford
If you post code or XML, **please** highlight those lines in the text editor and click on the "code" button (101 010) on the editor toolbar to nicely format and syntax highlight it!
marc_s
thank for every suggestion ,Although i have a little confused because i am a really rookie but i will try to do follow every suggestion.
Fernatit