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. Best way of Data Sync

Best way of Data Sync

Scheduled Pinned Locked Moved C#
questiondatabasesysadmin
11 Posts 3 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.
  • F fearless stallion

    Hi, I am bulding a simple windows application. the forms read data from the database and show it. the user can modify the data through the forms and the data is updated. it works fine as long as it is used by single user on a single machine. But I want this to be used by different users on the network. There may be an instance where two or more users can open the same form. So any changes made to a record by one user can not be reflected on the other end :(. but i want changes to be reflected on all machines where the same form is opened. How can i achieve this :confused: ? Please suggest me a way ? thanks in advance

    kss

    N Offline
    N Offline
    Nader Elshehabi
    wrote on last edited by
    #2

    fearless stallion wrote:

    the forms read data from the database and show it

    What data provider you use? Whether you use Oracle, Sql Server, Db2, etc... It's the responsibility of that Database engine to synchronize the data read/write access. For sure there won't be any write errors, yet if you didn't update your data in the form, it could be inaccurate as it has been updated by another user. So from time to time you should refresh your display based on something -e.g. timer, events, messages, etc...-.

    Regards:rose:

    F 1 Reply Last reply
    0
    • F fearless stallion

      Hi, I am bulding a simple windows application. the forms read data from the database and show it. the user can modify the data through the forms and the data is updated. it works fine as long as it is used by single user on a single machine. But I want this to be used by different users on the network. There may be an instance where two or more users can open the same form. So any changes made to a record by one user can not be reflected on the other end :(. but i want changes to be reflected on all machines where the same form is opened. How can i achieve this :confused: ? Please suggest me a way ? thanks in advance

      kss

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #3

      If the database is Sql Server 2005, you could always use SQL Server Notifications to notify clients that an event has happened. It would be the responsibility of the client to retrieve/work out what the changes are. This is not a task for the faint hearted and I am currently writing a set of articles on how to use Notifications.

      the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
      Deja View - the feeling that you've seen this post before.

      F 1 Reply Last reply
      0
      • N Nader Elshehabi

        fearless stallion wrote:

        the forms read data from the database and show it

        What data provider you use? Whether you use Oracle, Sql Server, Db2, etc... It's the responsibility of that Database engine to synchronize the data read/write access. For sure there won't be any write errors, yet if you didn't update your data in the form, it could be inaccurate as it has been updated by another user. So from time to time you should refresh your display based on something -e.g. timer, events, messages, etc...-.

        Regards:rose:

        F Offline
        F Offline
        fearless stallion
        wrote on last edited by
        #4

        Hi, Thanks for the reply, I think , what i have written earlier is a little confusing. I am using MySql provider. and there is no problem with MySql provider. But what i want is: for eaxmple: if Two users "Chris" and "Sally" open the same form. suppose Chris Modifies the record no.13 and the record is updated to database but Sally's screen still shows the Old data. I can refresh the whole screen by re-fetching the data from the DB but is time consuming. but i want some other solution may be an network event kind, whenever change occurs in other machine. it(machine) sends a message kind to all the peers(who have the same form opened). so that i can manage it on the frontend itself. as the data is huge so it is not possible for me to refresh again and again. How far this is possible ? thanks again

        kss

        N 1 Reply Last reply
        0
        • P Pete OHanlon

          If the database is Sql Server 2005, you could always use SQL Server Notifications to notify clients that an event has happened. It would be the responsibility of the client to retrieve/work out what the changes are. This is not a task for the faint hearted and I am currently writing a set of articles on how to use Notifications.

          the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
          Deja View - the feeling that you've seen this post before.

          F Offline
          F Offline
          fearless stallion
          wrote on last edited by
          #5

          Thanks but I using MySQL 5.0.

          kss

          P 1 Reply Last reply
          0
          • F fearless stallion

            Thanks but I using MySQL 5.0.

            kss

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #6

            You could roll your own version. It wouldn't be trivial, but would work like this: Have your application poll a notifications table at a regular interval. Whenever a record is inserted/updated/deleted that you are interested in, update the notifications table. If there is a record there that you are interested in (probably identified via a timestamp) refresh your application

            the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
            Deja View - the feeling that you've seen this post before.

            F 1 Reply Last reply
            0
            • P Pete OHanlon

              You could roll your own version. It wouldn't be trivial, but would work like this: Have your application poll a notifications table at a regular interval. Whenever a record is inserted/updated/deleted that you are interested in, update the notifications table. If there is a record there that you are interested in (probably identified via a timestamp) refresh your application

              the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
              Deja View - the feeling that you've seen this post before.

              F Offline
              F Offline
              fearless stallion
              wrote on last edited by
              #7

              Can MessageQueue be used in this Context ?

              kss

              P 1 Reply Last reply
              0
              • F fearless stallion

                Hi, Thanks for the reply, I think , what i have written earlier is a little confusing. I am using MySql provider. and there is no problem with MySql provider. But what i want is: for eaxmple: if Two users "Chris" and "Sally" open the same form. suppose Chris Modifies the record no.13 and the record is updated to database but Sally's screen still shows the Old data. I can refresh the whole screen by re-fetching the data from the DB but is time consuming. but i want some other solution may be an network event kind, whenever change occurs in other machine. it(machine) sends a message kind to all the peers(who have the same form opened). so that i can manage it on the frontend itself. as the data is huge so it is not possible for me to refresh again and again. How far this is possible ? thanks again

                kss

                N Offline
                N Offline
                Nader Elshehabi
                wrote on last edited by
                #8

                Well. Here is how I do it 1- Put the database on the server. -intuitive, isn't it?-:) 2- Put a Windows Application -or service-, or Webservice according to either your program is on LAN/Internet respectively, as a gate to that database. 3- All requests are directed to that "Gate" program through remoting 4- All programs record there interest on the current displayed record and the gate keeps track of that 5- if a record is displayed on one client and another modifies it the gate notifies the interested clients using messages. 6- Messages and requests are preferably routed using Remoting. This is one way to do it. Does this help?

                Regards:rose:

                F 1 Reply Last reply
                0
                • F fearless stallion

                  Can MessageQueue be used in this Context ?

                  kss

                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #9

                  Probably not. Well, you could use it but it doesn't bring you any benefits.

                  the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
                  Deja View - the feeling that you've seen this post before.

                  1 Reply Last reply
                  0
                  • N Nader Elshehabi

                    Well. Here is how I do it 1- Put the database on the server. -intuitive, isn't it?-:) 2- Put a Windows Application -or service-, or Webservice according to either your program is on LAN/Internet respectively, as a gate to that database. 3- All requests are directed to that "Gate" program through remoting 4- All programs record there interest on the current displayed record and the gate keeps track of that 5- if a record is displayed on one client and another modifies it the gate notifies the interested clients using messages. 6- Messages and requests are preferably routed using Remoting. This is one way to do it. Does this help?

                    Regards:rose:

                    F Offline
                    F Offline
                    fearless stallion
                    wrote on last edited by
                    #10

                    Well I Have never worked on Remoting and if this will help me then i Would not mind Working. I will look into this , if you have any good links of this kind of implementation then can please let me know, it will be of great help Thanks again

                    kss

                    N 1 Reply Last reply
                    0
                    • F fearless stallion

                      Well I Have never worked on Remoting and if this will help me then i Would not mind Working. I will look into this , if you have any good links of this kind of implementation then can please let me know, it will be of great help Thanks again

                      kss

                      N Offline
                      N Offline
                      Nader Elshehabi
                      wrote on last edited by
                      #11

                      fearless stallion wrote:

                      if you have any good links of this kind of implementation

                      If you mean remoting, try this link[^]. It'll get you started in no time.

                      Regards:rose:

                      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