How to return a proper "Successful" or "Failed" notice to SQL Server Jobs from a VB.NET application

  • Thread starter Thread starter BostonNole
  • Start date Start date
B

BostonNole

Under SQL Server 2000 Enterprise Manager, under Managment and under
Jobs you can view a jobs history "View Job History..." by right
clicking on any job. Each job lists either "Successful" or "Failed".

I have a VB.NET application that is run by one of these jobs. Like a
good programmer I handle all my exceptions within my application and
clear them appropriately.

If a certain exception does occur I want to be able to return to the
SQL Job that started my VB.NET application a "Failed" notice so it will
be tracked appropriately by the Job History.

Anyone know how to do this?

How to return a proper "Successful" or "Failed" notice to SQL Server
Jobs from a VB.NET application?
 
I figured part of it out myself after I posted this.

I changed my Sub Main to a Function Main () As Integer and I return 0
for Successful or 1 for Failed.

Does anyone know how to get an actual error message returned to the SQL
Job so it so it shows up in the descriptions when you check off "Show
step details"?
 
Back
Top