Solved

Triggering events when a job from SQL server finishes

Posted on 2004-09-15
3
276 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
conditional code and condition difference 9 84
canBalance challenge 34 98
Need To Find FireFox Binary Path For Python Selenium On Windows 7 15 731
allswap challenge 6 116
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

821 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