locked
SQLce detec unsynced changes and inserts RRS feed

  • Question

  • Hi there,

    I am trying to detect rows in my client database that have not synchronized to the server (both changes and inserts). The client is an SQLCE DB and the server is SQL Azure. Sync occurs over WCF services. I know I can hook up the ChangesSelected event - but that seems to require a round trip to the server and I'm trying to avoid that.

    I have recorded the last sync time - and can get the rows that have changed on the client by querying the tracking table in the SQLCE client DB. Newly inserted rows do not appear in the tracking table. Is is safe to assume that newly inserted rows are represented by rows that are in the base table and do not have corresponding rows in the tracking table?

    If not, what is the best way to detect newly inserted rows on the client?

    Thanks in advance for any help.

    Ian

    Monday, April 16, 2012 9:02 PM

All replies

  • Okay, so I found the following article in SQLCE books online: ms-help://MS.SSC.v35/MS.SSC.v35.EN/sscprog/html/5be071e5-41c9-4775-85d4-a41d6a370fe7.htm that details the change tracking in SQLCE, but I am a little confused as to where/how I can retrieve the @LCSN value. 

    Any help would be appreciated!

    Thanks,

    Ian

    Tuesday, April 17, 2012 12:04 PM
  • Hi JuneT - thanks for the reply.

    I have looked at that link before, but the problem is I'm using sync framework 2.1 and SQLCe 3.5 SP2.

    There doesn't appear to be any __sysSyncArticles table anymore and that is my problem.  In the link you posted the value for the @LCSN parameter is the sentAnchor retrieved from the __sysSyncArticles table.  I am unclear where this is stored now with the change tracking on SQLCE 3.5 SP2.

    If I could find that value - I should be fine.

    Thanks for you help. 

    Saturday, April 21, 2012 3:45 PM
  • i think the system tables are now __sysOCSTrackedObjects,  __sysOCSDeletedRows and __sysTxCommitSequence

    these are hidden and you can find out about the structure by querying the information_schema views

    Thursday, April 26, 2012 11:18 PM
  • Thanks JuneT,

    For now I'm using this method: http://social.microsoft.com/Forums/en-US/syncdevdiscussions/thread/a9ad106d-419b-435a-9149-b3c512fb1253

    Not sure if it is correct, but it seems to be working for the moment.

    Thanks again for your help.

    Friday, May 18, 2012 4:41 PM