Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update records automatically between computers C #

I need help. I am currently building data management applications using Winforms and C#. This application has been installed on 10 computers and are connected to one database on the server. Network only in the office.

These applications use the data grid view to display a list of employees.

The main problem now, if users on PC-A has entered a new record or update employee records, data grid view on PC-B is not updated automatically. So if I want to refresh the data grid view on PC-B, I need to press the "REFRESH" button to reload the record.

So the question is now, there are other ways to 'Data Grid View' can be updated automatically?

I do not know what it is named this method, so I hope there is anyone willing to help me in solving this problem. If the my question is already exist, hope someone can give me a link.

Thanks for help :)

like image 915
Azri Zakaria Avatar asked Dec 08 '25 13:12

Azri Zakaria


1 Answers

In order to achieve what you want, you will need to do some fairly complex architecture work. There is no simple fix here, I am afraid.

The problem is that you want your data girds to update based on an EVENT, however that event occurs outside the application in the database. In order to register that EVENT, you will need to have a class or service which is responsible for handling all INSERTS/UPDATES/DELETES.

If you define all of your tables or views as ARTICLES, you could then have a Publisher / Subscriber model. The Data service would handle all the inserts updates and deletes for the application, and push notifications that an ARTICLE has changed to all the Subscribers for the article. On each page you could have a Class which subscribes to an Article which relates to the data displayed on your data grid, and when it receives a message that the article has been updated, rebinds the data grid to the data source. Try reading this WIKIPEDIA article on the Observer pattern to get an idea of what the architecture might look like.

http://en.wikipedia.org/wiki/Observer_pattern

like image 109
Eric Avatar answered Dec 10 '25 02:12

Eric



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!