How can a program in diferent PCs using the same DB be notified of a change?
-
Hi guys i wrote a program that connects to a DB that is in a LAN, and i have others PCs accessing it, the problems is how do i notify all the programs that are connected to that DB of a change in it? Or maybe i am not using a good approach can someone help me please? :laugh:
-
Hi guys i wrote a program that connects to a DB that is in a LAN, and i have others PCs accessing it, the problems is how do i notify all the programs that are connected to that DB of a change in it? Or maybe i am not using a good approach can someone help me please? :laugh:
You can't reliably notify all interested PCs as some of them could be off-line or powered down. What you can do however is have a special table, row and field that contains say the "generation" number. And each of your applications could: 1. hold a copy of the generation number in a local file; 2. at start-up compare the database generation with the local copy, and when different, act on it. It isn't clear what you want this for. There may be other and more appropriate ways depending on your goals. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use < PRE > tags for code snippets, it preserves indentation, and improves readability.
-
You can't reliably notify all interested PCs as some of them could be off-line or powered down. What you can do however is have a special table, row and field that contains say the "generation" number. And each of your applications could: 1. hold a copy of the generation number in a local file; 2. at start-up compare the database generation with the local copy, and when different, act on it. It isn't clear what you want this for. There may be other and more appropriate ways depending on your goals. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use < PRE > tags for code snippets, it preserves indentation, and improves readability.
Thanks Luc. This program is a stock/selling system for a store. Problem is this i have for example 2 PCs that handle sells and the 3rd one is only watching the storage contents, there can be this issue when some items are not anymore in stock. The only way is to use a timer then?
-
Thanks Luc. This program is a stock/selling system for a store. Problem is this i have for example 2 PCs that handle sells and the 3rd one is only watching the storage contents, there can be this issue when some items are not anymore in stock. The only way is to use a timer then?
It depends on how you want to run the store I guess. You can't sell what isn't in stock, so your points of sale have to know and update stock quantities; how often do you order? how about running the order program once a day, checking all items are sufficiently stocked? :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use < PRE > tags for code snippets, it preserves indentation, and improves readability.