0

I drawed a picture in paint to illustrate my question better.

enter image description here

Red arrows represent connection for reading and changing data. The green boxes are same but separate programs in different computers including DataGridView that displays the DataBase info. The green boxes also can add or remove records from the database. However I can't seem to figure out that when one of the green programs does this, how does the other program know about this action to refresh their datagridview with new data?

Some extra info: - Only changes that are made are adding or removing a record/row and so I think there is no need to loop through datatable rows to check for changes, especially since there are very much records in table. - All the green boxes / computers running the program are connected to single public drive folder, so maybe somehow one solution could be that they would read some kind of a file from inside the public folder with a timer and update it when they change something in the database so other computers know by reading the file. (No clue how to do this though)

What would be your suggestions? Thanks!

Danila Ganchar
  • 10,266
  • 13
  • 49
  • 75
Markus
  • 65
  • 1
  • 5
  • This is why you should separate your whole application in different layers. 1st layer would be a thin client running in the green boxes. They are just to show the UI and send data/logic requests to the 2nd layer which is typciall an Application Server (e.g. IIS) it runs all the business logic and handles the requests from the client and call the 3rd layer which is your database. Now in the 2nd layer you provide logic to handle concurrent access to the same data source. There are some feasible strategies to do so but my comment runs out of chars :) I can give you an example if you´d like to. – Alex B. Nov 16 '16 at 11:11
  • Hmm I would love an example thanks, I don't really understand what you mean by layers, separate applications? If so then how do they communicate with each other? – Markus Nov 16 '16 at 11:30
  • I don´t have time to write a detailed answer right now. I will try after work. Please check [this](http://stackoverflow.com/a/312197/2882256) in the meantime. – Alex B. Nov 16 '16 at 13:07
  • A DataTable cant be changed "externally". Different apps might make changes to the underlying database though. Some databases provide the means to monitor changes for others it is possible to roll your own monitor. Actually picking up changes in a multiuser app is what the DataAdapter does. – Ňɏssa Pøngjǣrdenlarp Nov 16 '16 at 14:22

0 Answers0