Question Need to refresh datagridview when SQL server changes

WolfEmery

New member
Joined
Apr 15, 2016
Messages
2
Programming Experience
1-3
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!
 
No you can't. A trigger is really about making an additional change to the database, e.g. a very common scenario is inserting to an audit table each time as change occurs. That said, you do have an alternative. If you have a relatively small number of clients, you can use the SqlDependency class to have the server notify you when a change occurs.
 
Thank you jmcilhinney! I do have a small number of clients, only around 20. I will research SqlDependency class. I'm just looking for a better way than using a timer to refresh the DataGridView.
 
Back
Top