Solved

Triggering events when a job from SQL server finishes

Posted on 2004-09-15
3
260 Views
Last Modified: 2012-05-05
I am writing an application that shows a list of jobs available from SQL server. It allows the user to select a job and start it. My question is how do I let the user know that the job has finished before executing the next job. I know that in VB 6 you had some events that were triggered by a connection object(Execute_Complete) but that is not the case in vb.net. Is there a way that this can be done?

Thanks
0
Comment
Question by:ggarracrema
3 Comments
 
LVL 19

Accepted Solution

by:
arif_eqbal earned 500 total points
ID: 12071882
Well if you are just looking for an equivalent of Execute_Complete you can use StateChange event of the Connection object.

For eg
Say you have a connection...
Dim Cn as SQLConnection=New SqlConnection(ConnectString)

Create a Handler for StateChange Event...
AddHandler Cn.StateChange, New StateChangeEventHandler(AddressOf OnStateChange)

Then..
Public Sub OnStateChange(sender As Object, args As StateChangeEventArgs)
       Here Check if args.CurrentState is not one of Connecting,Executing and Fetching, it means it is idle
       Also to be sure you can check if args.OriginalState was either Executing or Fetching based on your query

End Sub
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now