Error: Cannot obtain the value for command parameter RRS feed

  • Question

  • Hi All,

           I taste same error just like OverloadedOverrides .

           In my code:

    SyncStatistics stats = syncAgent.Synchronize();


           It throw an error with message:

           "Unable to set session parameters in DbServerSyncProvider.

           Cannot obtain the value for command parameter '@sync_client_id_binary'."

    The message is clear that the value of the parameter is empty or null.

    But I don't know how I can debug or trace the code.

    I've tried this :


    but I've failed.

    Anyone can help me ?


    Monday, May 3, 2010 2:48 AM

All replies

  • are you using SQL Change Tracking? have you checked your SyncAdapter commands if the @sync_client_id_binary is added in the parameters collection for commands that are referencing it?
    Monday, May 3, 2010 11:53 AM
  • Hi June T.

    Thanks for your attention.

    Are you using SQL Change Tracking?

    Yup, the app is using SQL Change Tracking

    Have you checked your SyncAdapter commands?

    this.InsertCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@sync_client_id_binary", System.Data.SqlDbType.VarBinary));

    The app has 90++ tables that using it.

    FYI, the application using:

    Microsoft.Synchronization.Data.dll Version

    Microsoft.Synchronization.Data.Server.dll Version

    Microsoft.Synchronization.Data.SqlServerCe.dll Version

    And if I installed the SSCERuntime-ENU-x86.msi and app load the dll from the GAC the app will run.

    But if the app loads the dll from local library it wills error.

    I guess it related to the environment setting or registry.

    Does anyone have clue about this or how to debug synchronization process?



    Tuesday, May 4, 2010 12:58 AM
  • can you run SQL Profiler to determine which of the SQL commands is raising the error on @sync_client_id_binary?
    Tuesday, May 4, 2010 12:31 PM
  • Hi JuneT,

    Yeah, I already did it. But the error is shown before the sync process. So the SQL profiler is not shown any message.

    The error message is raise when the initialization (SyncAdapter) process is complete and just before the sync process begin.

    Below is the full information about the error:

    Initial Sync Exception:
    Sync Exception: Unable to set session parameters in DbServerSyncProvider. Cannot obtain the value for command parameter '@sync_client_id_binary'.
    Stack Trace: at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.SetSessionParameters(IDbCommand cmd, SyncGroupMetadata groupMetadata, SyncTableMetadata tableMetadata, SyncSession syncSession, DataColumnCollection columns, SyncStage stage)
     at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.EnumerateChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession, IDbTransaction transaction, EnumerateChangeType changeType)
     at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)
     at Microsoft.Synchronization.SyncAgent.DownloadChanges(SyncGroupMetadata groupMetadata)
     at Microsoft.Synchronization.SyncAgent.Synchronize()
     at Companion3.Sync.Services.SyncService.syncWorker_DoWork(Object sender, DoWorkEventArgs e) in C:\2008\SmartClient\Source\Sync\Sync\Services\SyncService.cs:line 306

    I already tried to look at the process using Process Monitor tool from sysinternal. But still I could not find any clue to fix it.

    Does anyone have experienced this before ? Please let me know what I should be checking.

    Thank you very much for the assistance.

    Wednesday, May 5, 2010 9:54 AM
  • can you check SyncSession.ClientId to see if it has any value? are you using WCF?

     If installing SSCERuntime-ENU-x86.msi fixes it, can you not just fix your references?


    Wednesday, May 5, 2010 11:33 AM
  •        Unfortunately, the application is preferred to be deploy using private installation without installing the SSCERuntime-ENU-x86.

           Currently the app using web service and not using the WCF.

           Now, I'm trying this . I hope it works.



    Thursday, May 6, 2010 6:18 AM
  • verify that the SyncSession is being passed properly and that the web service get's the values for the session parameters.
    Thursday, May 6, 2010 11:07 AM