Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How can a program in diferent PCs using the same DB be notified of a change?

How can a program in diferent PCs using the same DB be notified of a change?

Scheduled Pinned Locked Moved C / C++ / MFC
questiondatabasehelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    manchukuo
    wrote on last edited by
    #1

    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:

    L 1 Reply Last reply
    0
    • M manchukuo

      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:

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      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.

      M 1 Reply Last reply
      0
      • L Luc Pattyn

        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.

        M Offline
        M Offline
        manchukuo
        wrote on last edited by
        #3

        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?

        L 1 Reply Last reply
        0
        • M manchukuo

          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?

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups