VB.net and SQL Server

Soldato
Joined
18 Oct 2002
Posts
7,515
Location
Maidenhead
Hi all,

Ive got an application which I am creating in vb.net. It sits in the system tray and I need it to monitor a SQL 2008 database for new records in a table. When a new record is added, I need it to run a sub in my vb.net app.

To give you an idea, it is monitoring an ANPR system so when a new vehicle is detected I need to prompt the user.

So the question is how. The database is over the network and I need to be careful about performance, so I could do a select statement every x seconds and compare that to the previous result, but that seems inefficient.

Any ideas?
 
Im only looking for the latest insert. ie

Select top 1 plate from dbo.reads_001 order by timestamp desc

I dont need to worry about any other changes.

Would the method suggested by Truz be any more efficient as i;ll still be querying a table.
 
Cool, will need to look in to it then. Dont have a clue where to start on triggers and pruning
 
It is unlikely due to the position of the cameras ie the vehicle comes to the weighbridge, is picked up by ANPR at the weighbridge and they must weigh the vehicle in/out before it can proceed and the next vehicle is detected.

I suppose I may need to find all records since the last action and display them to the user though.
 
No the user is in the weighbridge office next to the weighbridge which is where the vehicle is.

At most there will be two machines accessing the data at one time, although they will be accessing the records for different cameras (therefore different sql statements)
 
Back
Top Bottom