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#
  4. How do you implement the auto reload process from database data in windows form for display?

How do you implement the auto reload process from database data in windows form for display?

Scheduled Pinned Locked Moved C#
databasewinformsquestion
6 Posts 4 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.
  • C Offline
    C Offline
    calendarw
    wrote on last edited by
    #1

    Hi, I am required to implement the reload process for display updated data if database has been changed by other user in Windows Forms, dose anyone has similar exp for share? I am planned to use the polling method but dose it contain alternative solution? Thanks.

    M S D 3 Replies Last reply
    0
    • C calendarw

      Hi, I am required to implement the reload process for display updated data if database has been changed by other user in Windows Forms, dose anyone has similar exp for share? I am planned to use the polling method but dose it contain alternative solution? Thanks.

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      What is your database, SQL 2005 has some extended functionality to support the but it is not simple.

      Never underestimate the power of human stupidity RAH

      C 1 Reply Last reply
      0
      • C calendarw

        Hi, I am required to implement the reload process for display updated data if database has been changed by other user in Windows Forms, dose anyone has similar exp for share? I am planned to use the polling method but dose it contain alternative solution? Thanks.

        S Offline
        S Offline
        SeMartens
        wrote on last edited by
        #3

        Hi, there is an alternative solution to polling. The technique itself is based on the observer pattern. The model (database etc.) informs all before registered listeners about a change in the model. The listener itself can then react accordingly. You have two options to implement this: 1) Some database-server can inform registered applications (through the connection) about changes in the database. Check if you DBMS can do this (look for event or sth. similar). 2) Implement a layer which communicates between different hosts. Then use this layer to send a message to all registered applications that you performed a database change. (You should avoid using this solution. Better use your polling mechanism) Hope this helps. Regards Sebastian

        It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.

        C 1 Reply Last reply
        0
        • M Mycroft Holmes

          What is your database, SQL 2005 has some extended functionality to support the but it is not simple.

          Never underestimate the power of human stupidity RAH

          C Offline
          C Offline
          calendarw
          wrote on last edited by
          #4

          the target database should be mssql 2k, so dose it support this function?

          1 Reply Last reply
          0
          • S SeMartens

            Hi, there is an alternative solution to polling. The technique itself is based on the observer pattern. The model (database etc.) informs all before registered listeners about a change in the model. The listener itself can then react accordingly. You have two options to implement this: 1) Some database-server can inform registered applications (through the connection) about changes in the database. Check if you DBMS can do this (look for event or sth. similar). 2) Implement a layer which communicates between different hosts. Then use this layer to send a message to all registered applications that you performed a database change. (You should avoid using this solution. Better use your polling mechanism) Hope this helps. Regards Sebastian

            It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.

            C Offline
            C Offline
            calendarw
            wrote on last edited by
            #5

            1. The target database should be mssql 2k, so dose it contain an event for supporting this feature? or any keyword can help for search? I don't know what kind of term can be used for this "feature". 2. New layer for communication should not work if my target is 2 tier (client program and mssql database), so I don't know where should place the layer if without server application. Thanks~

            1 Reply Last reply
            0
            • C calendarw

              Hi, I am required to implement the reload process for display updated data if database has been changed by other user in Windows Forms, dose anyone has similar exp for share? I am planned to use the polling method but dose it contain alternative solution? Thanks.

              D Offline
              D Offline
              dojohansen
              wrote on last edited by
              #6

              FYI, I've read on and noticed you need this to work with MSSQL Server 2000. You've said little about your scenario so it's a bit tricky to give any advice. So this is just some general info instead. The database does not provide anything that makes it directly easy to provide an event in your application. It is possible though. One way is to write an extended stored procedure in C++ that notifies your application (for example using a message queue) that the update has taken place, and then call this from a trigger in the database. Another option is available if the database is (supposed to be) accessed only via your client app and you can update all installed clients before the feature becomes (fully) functional. In this case you could use remoting or message queues or web services or even sockets (if you like to needlessly complicate things and reinvent the wheel :)) to notify all clients when any client has just modified the data in question. To be honest, I think polling is a better option. Just remember that if you've got loads of clients and poll frequently it will generate considerable load on the database and it may be smart to put a caching server in the middle. 500 clients polling every 5 seconds is 100 requests per second. If you've got such a case, consider making an app that polls the db every 5 seconds and updates a cached value (such as a timestamp). Then clients can poll this app (which of course responds based on the cached information) without having to acquire shared locks in the database and the rest of the overhead of executing some query a hundred times per second.

              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