Solved

Triggering events when a job from SQL server finishes

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Change to event 1 111
Advice in Xamarin 21 78
Problem to refer to value 8 45
Android development question 2 35
Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

774 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