Click here to Skip to main content
15,891,941 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a VB.Net application that I created for my job. It runs on multiple users PC's and uses Access databases for data storage, with a timer to refresh the DataGridView every 5 minutes to keep everyone up-to-date. Now I'm switching over to SQL Server Express 2014 and I've heard that it has triggers that flag changes. What I'm wanting to know is if I can use these, instead of timers, to trigger an update to the DataGridView whenever something is changed in the SQL Server table? Any VB.Net or SQL code examples would be greatly appreciated. Thanks for any help!

What I have tried:

Have tried Google searches for SQL Server triggers, but nothing made sense.
Posted
Updated 15-Apr-16 9:02am

I'm going to say it is probably not possible. Sql server triggers fire when something is inserted, updated, or deleted, but that is not exposable through anything that would talk to your vb project. The only think I could suggest is to have a rowguid and a modified date on each table, and on a timer, go check the rowguid. If it is different, then reload your data, being careful to not overwrite changes the local user has made.

If multiple users are in an access database(using only access forms and grids), then somehow(magically) changes from one user show up in the others forms and grids. I have not seen anything so magical for ado.net. Please correct me if I'm wrong.
 
Share this answer
 
There are ways to track data changes in SQL Server, in the form of Change Data Capture and Change Tracking. You can read about them. But the solution you are looking for may be achieved using SqlDependency. There are a couple of articles in CP that explain how to use this for getting notification about changes.

It may not be exactly what you are looking for, but may help you go in the right direction.

Using SqlDependency for data change events[^]
Query Notification using SqlDependency and SqlCacheDependency[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900