locked
SyncParameters array RRS feed

  • Question

  • I am trying to pass in an array of guids as the filter to the server side. My client code is as follows:

     

    Configuration.SyncParameters.Add(

     new SyncParameter("@householdId", "'123c837e-a5b6-4ebb-bcc1-5986f493d7cc', '123c837e-a5b6-4ebb-bcc1-5986f493d7cc'" ));

     

     

    On the server side, I set my command based on this filter, such as:

     

    contactSyncAdapter.SelectIncrementalInsertsCommand.CommandText =

    "select * from Contact where householdId in (@householdId)";

    contactSyncAdapter.SelectIncrementalInsertsCommand.Parameters.Add(

    new SqlParameter("@householdId", SqlDbType.NVarChar));

     

    This generates an error on the server. Is there a preferred way to pass in an array of paramaters for the above case?

     

    Thanks,

    Arshad

    • Moved by Max Wang_1983 Friday, April 22, 2011 8:00 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Thursday, April 17, 2008 5:18 PM

All replies

  •  

    Hello Arshad,

     

    How about adding '123c837e-a5b6-4ebb-bcc1-5986f493d7cc' and '123c837e-a5b6-4ebb-bcc1-5986f493d7cc' as 2 different Sync Parameters to the SyncAgent.Configuration and on the Server Command, you can try "where householdId in (@householdid_1, @housholdid_2) ..."

     

    Thanks.

    Leo

    Thursday, April 17, 2008 11:25 PM
    Answerer
  • The only problem is that the number of households can change with each sync. I can change this dynamically on the client side, but how do I pass this information to the server side? The constructor of DbServerSyncProvider in the web service doesn't take a parameter.

     

    Thanks,

    Arshad

    Friday, April 18, 2008 12:21 AM
  • Actually you were on the right track.

     

    Can you try this one

     

    contactSyncAdapter.SelectIncrementalInsertsCommand.Parameters.Add(

    new SqlParameter("@householdId", SqlDbType.NVarChar, 4000));

    Friday, April 18, 2008 4:19 AM
    Answerer
  • I'll give it a try.

     

    Thanks,

    Arshad

     

    Friday, April 18, 2008 5:29 PM