Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Datagridview in winforms application updated automatically when there is any change in database

I am working on a winforms c# application which is using the technologies like Entity Frame work-code first.i have to make a form in which records from database continuously should shown.first i apply a simple timer technique which updates Grid and other control after 5 sec. but it is too much expensive and eat resources.

i want to ask is there any other sophisticated method by which data in DGV and other controls automatically updated if any change happen in Database.

like image 595
Umar Abbas Avatar asked Jan 27 '26 03:01

Umar Abbas


1 Answers

http://dotnet.dzone.com/articles/c-sqldependency-monitoring

Look into SQLDependency. It is designed for this exact scenario.

There is a DataChanged event handler.

I used it very recently on a project for showing 'live' data from our TFS server and it's working very well.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!