locked
Filters when using N-Tier RRS feed

  • Question

  • Hello All

    I am currently implementing a N-Tier sync application using the SQLExpress Client provider.

    On the server, I hold information for many different customers, defined by a SiteID (int) column which is present in every table.


    How do I tell my client application to only sync the data for a specific client ID?

    If I am right, I need to add a SyncParameter to the SyncAgent, e.g.

                    Dim sp As New SyncParameter
                    sp.Name = "@SiteID"
                    sp.Value = 2 ' just for testing
                    Agent.Configuration.SyncParameters.Add(sp)

    But how does that parameter get passed to the server, and how do I use it at the server to filter the data?
    • Moved by Max Wang_1983 Friday, April 22, 2011 4:46 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Monday, September 29, 2008 1:51 PM

All replies

  • Hi

     Below is a sample of how to define a new sync paramter:

     

    In the syncengine:

    define  a new string value:

    public string SyncPara

    {

    set { syncPara= value; }

    }

    private string syncPara= "";

     

    syncAgent.Configuration.SyncParameters.Add(new SyncParameter("@SyncPara", syncPara));

     

    in your syncadapter , you can add your sync paramter to your select statements, such as:

     

    incrementalUpdates1Cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@SyncPara", System.Data.SqlDbType.Int));

     

    From the client side, you can call the syncengine and give him a value for your sync parameter:

    syncEngine.SyncPara= 1234;

     

    Hope this will help

     

    Thanks

     

     

     

     

     

     

    Tuesday, September 30, 2008 4:32 AM