Update table on server side RRS feed

  • Question

  • Hi

    I am struggling to get one specific scenario working. I am still using sync services 1.0.

    The scenario is as follows:

    There are two scanners. Each one can scan the same barcode (Primary Key). If scanner A cradle and sync, the record must be inserted into a table ScannerCapture. When scanner B cradle and sync after scanner A the record must only be updated. The scanners should only upload to the server and after each sync the ScannerCapture table on the scanner should be cleaned (All records deleted).

    My current configuration for this table is as follows:

    Data to Download: New and Incremental changes after first sync

    Creation option: DropExistingOrCreateNewTable

    Compare updates using: LastChanged(this is a timestamp field)

    compare inserts using: none

    Move deleted items to: none


    This configuration is almost working except that if scanner A cradle first and a record is inserted and scanner B cradle after that with the same Barcoded record nothing happens. It looks like the sync service is ignoring scanner B's record because that record already exists.


    One last question: How easy is it to upgrade my application to a higher sync service version for example 2.0 or even 4.0

    Sunday, February 6, 2011 11:53 PM


All replies

  • am assuming your scanners are windows mobile devices. if they are, nothing has changed in v2.0 or v2.1 on the sql ce mobile device support/providers. v4.0 on the other hands has improve support for mobile devices but it's still on CTP.

    you're most likely encountering a sync conflict when the second device uploads rows having the same primary key as the rows uploaded by the first device. a quick workaround will be to modify the insert statement/stored procedure to check first if a row is existing. if it exists, do an update instead, otherwise, do an insert.

    Monday, February 7, 2011 12:35 PM
  • Hi June

    I also thought about changing the insert and update queries, but where exactly can I change this? At the moment I only choose my tables to sync from the designer and the rest of the code is generated for me.

    Monday, February 7, 2011 2:36 PM
  • if you use the wizard to generate the sync code, you'll have to replace the SQL generated by the designer.

    check out a similar step on overwriting the generated queries here: http://jtabadero.wordpress.com/2010/03/17/adding-filter-to-local-database-cache-generated-sync/

    the approach should be the same.

    Monday, February 7, 2011 11:25 PM