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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Programming for synchronization of local database with remote server database.

Programming for synchronization of local database with remote server database.

Scheduled Pinned Locked Moved C#
databasecsharpsql-serversysadminhelp
5 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.
  • D Offline
    D Offline
    Digubha
    wrote on last edited by
    #1

    Hii everybody, i am developing window application in c# and .net and i want to know that how to write a join query for update of local database by the content of remote server database!. Scenario :- Suppose there is one database say softbuyweb at local machine and other database softbuyweb1 at remote server. now there is table in softbuyweb say product and similarly there is table in softbuyweb1 say product1 now both the table product and product1 in database softbuyweb and softbuyweb1 respectively has same column/field name, datatype and length of datatype. now i want that in my window form i place one button say "Update" on its click event there should be query which fires and the total content of table product1 at remote server is copied and the content of table product at local machine is updated with that copied content. i think it is little confusing and also it may be difficult to write single sql query for two different data sorce connection and it might create ambiguity because both connection are establishes in a single block of code. now , please help me on this topic , and please response as qick as possible! my database is in sql server 2005. thanx in advance. :)

    E 1 Reply Last reply
    0
    • D Digubha

      Hii everybody, i am developing window application in c# and .net and i want to know that how to write a join query for update of local database by the content of remote server database!. Scenario :- Suppose there is one database say softbuyweb at local machine and other database softbuyweb1 at remote server. now there is table in softbuyweb say product and similarly there is table in softbuyweb1 say product1 now both the table product and product1 in database softbuyweb and softbuyweb1 respectively has same column/field name, datatype and length of datatype. now i want that in my window form i place one button say "Update" on its click event there should be query which fires and the total content of table product1 at remote server is copied and the content of table product at local machine is updated with that copied content. i think it is little confusing and also it may be difficult to write single sql query for two different data sorce connection and it might create ambiguity because both connection are establishes in a single block of code. now , please help me on this topic , and please response as qick as possible! my database is in sql server 2005. thanx in advance. :)

      E Offline
      E Offline
      Ennis Ray Lynch Jr
      wrote on last edited by
      #2

      The easiest way would be to link the SQL Server databases together so you could use an UPDATE FROM statement(Those things are like magic) Beyond that and using any sort of Database specific synchronization open a cursor, compare records, and update the outdated db.

      Need custom software developed? I do C# development and consulting all over the United States.
      If you don't ask questions the answers won't stand in your way.
      Doing a job is like selecting a mule, you can't choose just the front half xor the back half so when you ask me to do a job don't expect me to do it half-assed.

      M 1 Reply Last reply
      0
      • E Ennis Ray Lynch Jr

        The easiest way would be to link the SQL Server databases together so you could use an UPDATE FROM statement(Those things are like magic) Beyond that and using any sort of Database specific synchronization open a cursor, compare records, and update the outdated db.

        Need custom software developed? I do C# development and consulting all over the United States.
        If you don't ask questions the answers won't stand in your way.
        Doing a job is like selecting a mule, you can't choose just the front half xor the back half so when you ask me to do a job don't expect me to do it half-assed.

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

        Ennis Ray Lynch, Jr. wrote:

        UPDATE FROM

        Ennis can you elaborate on this. Is it like the select into shortcut for creating tables? Wondering if I have missed something all these years?

        Never underestimate the power of human stupidity RAH

        E 1 Reply Last reply
        0
        • M Mycroft Holmes

          Ennis Ray Lynch, Jr. wrote:

          UPDATE FROM

          Ennis can you elaborate on this. Is it like the select into shortcut for creating tables? Wondering if I have missed something all these years?

          Never underestimate the power of human stupidity RAH

          E Offline
          E Offline
          Ennis Ray Lynch Jr
          wrote on last edited by
          #4

          UPDATE customer SET customer.firstName = remoteCustomer.firstName FROM customer INNER JOIN remoteCustomer ON remoteCustomer.id = customer.Id AND remoteCustomer.GUID <> customer.GUID;

          Need custom software developed? I do C# development and consulting all over the United States.
          If you don't ask questions the answers won't stand in your way.
          Doing a job is like selecting a mule, you can't choose just the front half xor the back half so when you ask me to do a job don't expect me to do it half-assed.

          M 1 Reply Last reply
          0
          • E Ennis Ray Lynch Jr

            UPDATE customer SET customer.firstName = remoteCustomer.firstName FROM customer INNER JOIN remoteCustomer ON remoteCustomer.id = customer.Id AND remoteCustomer.GUID <> customer.GUID;

            Need custom software developed? I do C# development and consulting all over the United States.
            If you don't ask questions the answers won't stand in your way.
            Doing a job is like selecting a mule, you can't choose just the front half xor the back half so when you ask me to do a job don't expect me to do it half-assed.

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

            Thanks Ennis Nothing new there, just thought there might have been something quite different. Sometimes I come across something in the forums completely new in a tool I have been using for ages (eq SQL).

            Never underestimate the power of human stupidity RAH

            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