Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Activate VB app when specific data changes in SQL database

Status
Not open for further replies.

5166narda

Programmer
Jul 9, 2002
35
US
I need to figure out a way to get a VB app to run 24/7 and when specific data changes on the netwrok in SQL server, to pop up a screen, requesting additional information. Any information would be appreciated. I know how to write basic VB, just not how to keep an app running and how to trigger it to a specific event...

Thanks in advance
 
for an app to run 24/7 it just needs to be run, to have it run on startup the registry key is

hkey_local_machine\software\microsoft\windows\currentversion\run
as for the sql part, i'm not up on sql, but if you have your application poll the specific set of data in the database every interval (say 5 minutes, can use a vb timer or create your own timer), and if the data meets your criteria, pop up another form in your application, or if it's a seperate application, check out the shell function.
 
Do you really need it to be triggered as that may be tricky?

The simplest approach is to create a timer control on your form and set it trigger every so often. When the Timer Event occurs you check if anything interesting has happened and if so you process it. The frequency of the timer event is specified in milliseconds (up to to 65536ms if I remember correctly) but its granularity is limited to just under 20ms and there is no guarantee of precision.

For most applications a frequency of 10 to 60 seconds is usually appropriate. It should be longer than the time it takes to process any work that is found and you should turn off the timer while you are processing.

The program will keep running until you stop it, for example by clicking on a button or closing it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top