Filtering data with Sync framework from client. RRS feed

  • Question




    I want to filter client data which is stored in .sdf database and then sync with the server.

    When Client will login to the desktop application his data will be sent to server and related data will be downloaded. with normaly sync. I can sync the server tables and everything. But if multiple client login from same box to winforms application. I don't want to send/sync whole table data to server. Only the login client data will should go.


    CAn any one tell me how I can filter the client data and then sync with server..


    syncAgent.RemoteProvider = new ServerSyncProviderProxy(webserviceProxy);

    string connString = "Data Source=" + System.Configuration.ConfigurationSettings.AppSettings["LocalDataBase"];

    if (false == File.Exists(System.Configuration.ConfigurationSettings.AppSettings["LocalDataBase"]))


    SqlCeEngine clientEngine = new SqlCeEngine(connString);




    SqlCeClientSyncProvider clientSyncProvider = new SqlCeClientSyncProvider(connString);

    syncAgent.LocalProvider = clientSyncProvider;


    SyncTable tableLookup = new SyncTable("orders");

    tableLookup.CreationOption = TableCreationOption.DropExistingOrCreateNewTable;

    tableLookup.SyncDirection = SyncDirection.Bidirectional;

    SyncGroup orderGroup = new SyncGroup("123AllChanges");

    tableLookup.SyncGroup = orderGroup;


    syncAgent.Configuration.SyncParameters.Add("@selectedType", 0);


    SyncStatistics stats = syncAgent.Synchronize();



    CAn any one tell me how I can add Query for order table based on Order_ID or some other parameter

    • Moved by Hengzhe Li Friday, April 22, 2011 6:33 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Monday, December 22, 2008 3:51 PM

All replies


    After fighting a alot.. Icome to know we can filter client data from before uploading/sync with server. Try using

    ChangesSelected event of client provider.


    and you will be able to access the dataset and can filter it..

    Tuesday, December 23, 2008 5:22 PM
  • this is an interesting post.


    the sync service only support filtering data from the server to client ( i.e. download subset of data ). your scenario needs both download filtering and upload filtering if I understand it correctly.


    while using the upload change events can help your case by removing some data you don't want to sync. this is not a desired way to achieve it. I would suggest to put different set of data to different client db so that different user can access his/her own db which contains set of data only for her to upload. or put some filtering in the application level so that a user can only change what he can see and change, in such case, only his/her data will be synced.


    would be interested in further discussion on this scenario.




    Wednesday, January 14, 2009 5:54 AM