Client synch fails due to the replication of the primary key. Needing Help! RRS feed

  • Question

  • Hi Sync Team, for the ones that know what i'm talking about this could be very easy to solve or very difficult, the problem i'm experiencing is this:


    I developed a web application built based upon an n-tier metodology that comunicates with an MSSQL Server EE database. Now because of the business demands i needed to create a windows application able to sync with the remote database whenever the technicians of the company log into the win app and they have an internet connection. The sync i'am talking about here implies bidirectional synchronization of data from eight tables of my seventy existing tables being synchronized.


    To six of this tables only updates are executed because the data being changed makes part of a form (kind of a quiz but

    more complex), now in the other two tables are executed creates and deletes in the client, i have been around this for

    some time during the last weeks and i have been adviced to change all my primary keys from "int identity" colums to

    unique identifiers (GUIDS) and i already did it, but my main problem remains, the diagrams below explain better whats



    client db


    (before sync)


    anomaliesolutionID         anomalieID         solutionID        lasteditdate     creationdate

    122-sdds-sfdsfdf            12-e3rsdsd      err322-34344        NULL              11-01-2003 12:40:01

    sdad-df-sf322323           12-e3rsdsd      sss12-3423q        NULL              11-01-2003 12:40:01


    (after sync)


    the solutions are uploaded correctly to the server but then the server does this


    anomaliesolutionID         anomalieID         solutionID        lasteditdate               creationdate

    122-sdds-sfdsfdf            12-e3rsdsd      err322-34344        NULL                       11-01-2003 12:40:01

    sdad-df-sf322323           12-e3rsdsd      sss12-3423q        NULL                       11-01-2003 12:40:01

    12-e3rsdsd                    12-e3rsdsd      err322-34344       11-01-2003 12:40:31  11-01-2003 12:40:31


    the next record logically by this cenario is to insert the second record with the primary key equal to the anomalie

    id and because this violates the primary key unique constraint it fails to insert the other records that are redundant.

    this should not happen. i changed the insert of the client method in the table adapter to generate a new guid

    each time an insert is performed trought the function NEWID() and i did the same on the server insert method, and

    this should fix the problem but it doesnt.


    Does some one now why is my application adopting this self behaviour??? Can i be experiencing an ADO.NET Sync

    Services Bug ??


    Thanks in advance to all,


    With my best regards,



    JP.Pinho (Portugal-Lisbon)

    • Moved by Max Wang_1983 Friday, April 22, 2011 7:52 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Tuesday, April 29, 2008 8:21 PM

All replies

  • I have been searching and it looks like that i have to use something like sql sync table adapters, to specify custom commands to update this table. Still searching how to do it! Any help about this would be apreciated.


    Best Regards

    Wednesday, April 30, 2008 2:16 PM
  • from the dbsync adapter and server provider's point of view, there should be no difference between Ntier and two tier configurations,  you can take a look at this post and find doc and samples there. http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1219265&SiteID=1.


    the dbsyncadapterbuilder would the the object you will need to generate the sync adapter with the needed sql commands.




    Saturday, May 3, 2008 2:10 AM