Solved

Triggering events when a job from SQL server finishes

Posted on 2004-09-15
3
243 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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
data scientists and AI 17 67
copyEndy  challenge 15 54
WPF issue with Trigger 2 65
C# code editing and collaboration 3 38
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
This article will show, step by step, how to integrate R code into a R Sweave document
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

762 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

8 Experts available now in Live!

Get 1:1 Help Now