Uploading client changes to Server-Demo III Offline Webservice RRS feed

  • Question

  • Hello,

    I am trying to use Demo III code to use synch services for my application (using SQL Server 2005 and SQL CE 3.5 in Visual Studio 2005 envrionment). I have just one table for bi-directional synchronization. I can run the code and download all the records on the server onto the client when creating the schema initially. However after I have downloaded SDF on the client and then I add a record on the server and synch again, all I see in progress form is enumerating inserts, deletes and updates,
    but no inserts are applied. So I never get the record I added on the server after first synchronization.

    Also if I make inserts at the client and try to synch again, nothing gets pushed to the server. I am using the same code as Demo III except that instead of using stored procedures, I am using SQL statements in the web service. I have set the primary key in the table and so I am not using a row guid.

    Any ideas will be very helpful. I am not getting any error on progress form.



    Here is the source code for incremental insert that I am using in the web service

      SyncAdapter adaptorInventory = new SyncAdapter("InventoryTest");

    //Incremental Insert
     SqlCommand incInsInventoryCmd = new SqlCommand();
                incInsInventoryCmd.CommandType = CommandType.Text;
     incInsInventoryCmd.CommandText = "select INV_ID, GPA_ID, label,Tier1_ID, Tier2_ID, Tier3_ID, Tier4_ID, FeatureType, Active, date_created, user_created, date_edited, user_edited from [InventoryTest] " +
                                           " where date_created > @sync_last_received_anchor " +
                                             "and date_created <= @sync_new_received_anchor " +
                                             "order by date_created desc ";
                incInsInventoryCmd.Parameters.Add("@" + SyncSession.SyncClientIdHash, SqlDbType.Int);
                incInsInventoryCmd.Parameters.Add("@" + SyncSession.SyncLastReceivedAnchor, SqlDbType.DateTime);
                incInsInventoryCmd.Parameters.Add("@" + SyncSession.SyncNewReceivedAnchor, SqlDbType.DateTime);

    • Moved by Max Wang_1983 Friday, April 22, 2011 8:12 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Wednesday, April 2, 2008 5:59 PM

All replies

  • So I resolved the issue of not getting back newly added records on the server onto client by moving the following command to just before the incremental inserts command.

      // select new anchor command
                SqlCommand anchorCmd = new SqlCommand();
                anchorCmd.CommandType = CommandType.Text;
                anchorCmd.CommandText = "Select @" + SyncSession.SyncNewReceivedAnchor + " = GETUTCDATE()"; 
                anchorCmd.Parameters.Add("@" + SyncSession.SyncNewReceivedAnchor, SqlDbType.DateTime).Direction = ParameterDirection.Output;

                _serverProvider.SelectNewAnchorCommand = anchorCmd;

    However I am still not able to upload the inserts that I do on client to the server. Please note that in my table, I have two columns date_created (datetime) and date_edited(datetime) that I use to track when a row is inserted or updated at the server and I am bringing down these columns also in the SDF. Do I need to remove them from insert and update commands?


    Wednesday, April 2, 2008 7:37 PM