locked
How to sync only new records between two tables, local to remote? RRS feed

Answers

  • set your SelectIncrementalInsertsCommand
    set the SelectIncrementalDeletesCommand and SelectIncrementalUpdatesCommand on the Adapter to null or don't assign a command object.

    cheers,

    JuneT

    Wednesday, March 17, 2010 1:35 AM

All replies

  • set your SelectIncrementalInsertsCommand
    set the SelectIncrementalDeletesCommand and SelectIncrementalUpdatesCommand on the Adapter to null or don't assign a command object.

    cheers,

    JuneT

    Wednesday, March 17, 2010 1:35 AM
  • Thank you. If I want to add sync feature in my project, what steps should I take?
    What referrence do I need to add into my project?
    I already downloaded and installed sync sdk 2.0.
    Wednesday, March 17, 2010 1:44 PM
  • what do you need to sync? sqlserver to sqlexpress? sqlserver to sqlce? have you decided whether to go for the offline scenario or the collaboration scenario?

    the steps are pretty much in the documentation that comes with the SDK.

    Wednesday, March 17, 2010 2:04 PM
  • What I will create is a win program for offline using SQL 2008 Express (at client side) to SQL 2000 (at server side).
    What is difference of two download? Do I need to install 2) if I installed 1)?

    1) Microsoft Sync Framework 2.0 Software Development Kit (SDK)
    2) Microsoft Sync Framework 2.0 Redistributable Package

    Wednesday, March 17, 2010 7:29 PM
  • While I am learning this sample and found there are two tables, anchor and guid, are not in server.
    Why need them?

    Wednesday, March 17, 2010 9:15 PM
  • For development purposes, you only need to install #1.

    When you are distributing your application to end customers, you can include #2 with your own MSI/installation to install the Sync Framework on their computers.
    Wednesday, March 17, 2010 11:29 PM
  • While I am learning this sample and found there are two tables, anchor and guid, are not in server.
    Why need them?


    the sample you're working on is for offline scenario, where only the client keeps track of the the changes sent and changes received. The server doesnt keep track of what it sent and what it received.

    the anchor table is used by the client to keep track of last sent and last received changes. The guid to uniquely identify the client.
    Thursday, March 18, 2010 2:38 AM
  • Eevery time once run this sample, I will get this error message (about 35 lines) but once click ok, it will run no error.

    How to get rid of it?

    System.data.sqlcliten.sqlexception: Invalid object name 'order'
        at system.daa.sqlclient.sqlconnection.onerror(sqlexceptin exception, boolean breakconnection)
    ......
    ......
    ...getactivedatatable()....in syncform.vb:line 316
    ...refreshtable()... in syncform.vb:line 292
    ...radiosuborder_checkedchanged() in syncform.vb:line 161
    Thursday, March 18, 2010 1:38 PM
  • Another problem is how to initial two tables for anchor and guid if I want to use them in my project.
    For test, I truncate these two tables. Now, once click sync button I got conflict error.
    Thursday, March 18, 2010 1:54 PM
  • which table did you truncate?
    Thursday, March 18, 2010 1:59 PM
  • anchor and guid
    Thursday, March 18, 2010 2:27 PM
  • you would put the tablenames of the table you're synching in the anchor table. guid will just any guid you generate.
    Thursday, March 18, 2010 2:32 PM
  • I re-ran script to create local db. I found out that in guid table, guid is below. Where is coming from?
    901326DC-5F4E-4B18-BD1B-8B99732C72CC
    Thursday, March 18, 2010 2:42 PM
  • the script creates the guid table and populates it :

    CREATE TABLE ProviderSample_Local..guid (guid uniqueidentifier DEFAULT NEWID())
    go

    INSERT INTO ProviderSample_Local..guid (guid) VALUES (NEWID())
    go
    Thursday, March 18, 2010 2:53 PM
  • Thank you so much.
    Now, can you help me to fix this error? It is said "invalid object name 'order' but order table is existing in local and server.

    System.data.sqlcliten.sqlexception: Invalid object name 'order'
        at system.daa.sqlclient.sqlconnection.onerror(sqlexceptin exception, boolean breakconnection)
    ......
    ......
    ...getactivedatatable()....in syncform.vb:line 316
    ...refreshtable()... in syncform.vb:line 292
    ...radiosuborder_checkedchanged() in syncform.vb:line 161
    Thursday, March 18, 2010 3:04 PM
  • can you post the stack trace? is this your table or the table that comes with the sample?
    Thursday, March 18, 2010 3:32 PM
  • This is one table comes from the sample. (orders)
    How to get stack trace? There is no errors and warnings in error list.
    Once pressing F5, one page pop-up and display all messages (about 35 lines). By clicking ok to close this page, program will run fine.
    If available, I will email you screen shot as attachment.
    Thursday, March 18, 2010 4:00 PM
  • try to put a breakpoint on getactivedatatable() and see where which connection its sending the command.
    Thursday, March 18, 2010 4:29 PM
  • It happened at public sub new() after initializecomponet()
    Thursday, March 18, 2010 5:48 PM
  • I got it.
    If I disable the sub below there is no error page come out. The problem is

    RefreshTable()

     


    Private

     

    Sub radioSubOrders_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles radioOrdersClientDb.CheckedChanged

     

    Try

    clientDbIsActive = radioOrdersClientDb.Checked

    RefreshTable()

     

    Catch ex As Exception

    MessageBox.Show(ex.ToString())

     

    End Try

     

    End Sub

    Thursday, March 18, 2010 6:14 PM
  • I think that the final is GetActiveConnectionString() In my case, local server is SQL 2008 express and remote is SQL 2000. Both of them used SQL authentication mode
    Thursday, March 18, 2010 6:20 PM