How to get ChangesApplied() result? RRS feed

  • Question

  • We have the application that synchronize data between SqlServer 2008 and many tablet pc (sqlCe) for a long time now using the sync framework 2.1.  We customized  the DbServerSyncProvider to upload inserted rows without the primary keys so they get the new one from server . We use the ChangesApplied event to clean that data on sqlCe and it work fine. Now we have to modify the applicaton to make some updates on server durring then session. The Context.DataSet object contains uploaded data, but not updated after inserts on server, having original primary keys. I didn't found the way to update the dataset to get the last version and i really need this information. I would like to work with data in dataset and it all i need, if i only had the last version of that data... Do we really have to add the originator id in each table to identify data from one session (or one tablet Pc)?  Any suggestions?
    Wednesday, March 28, 2012 12:11 PM

All replies

  • You cannot get the newer version of those rows inside Sync Framework. as far as its concerned, the rows that were inserted were the rows that it has retrieved from the client. it has no idea of the manipulation you did in the dataset to remove the original PK column.

    you will have to query the server database directly. your problem though is how to retrieve the same rows you have in the dataset from the server since you modified the PK already. the originator id simply gives you which client a row has come from. it doesnt give you the specific rows within the sync session.

    had you inserted the PK value (in a non-PK column in the server) + originator id, you could use the combo to query the server to retrieve the new PK.

    Thursday, March 29, 2012 1:43 AM
  • Thanks for the reply

    that what we did, we have the non-pk column in the server which contains the original pk value. The probleme may occure  in case of synchronisation of few tablet pc in the same time having the same original PK values... I tried to avoid adding the originator id column, but it seems like i have no choice...

    Wednesday, April 4, 2012 2:33 PM