locked
Unable to set session parameters in DbServerSyncProvider for tables which has only one column? RRS feed

  • Question

  • hi you,

    I have a critical bug  when perform syncing on two databases.

    I have debugged and detected that, it was failured on all tables that have only one column.

    This is error message "{"Unable to set session parameters in DbServerSyncProvider. Cannot obtain the value for command parameter '@Name'."}"

    Note: i make sure that "Name" column existed in my table. I have skipped over 4 tables that have only one column named "Name" then syncing works fine.

    The below is stacktrace of this bug:  

       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.ExecuteSelectCommand(IDbCommand cmd, SyncTableMetadata tableMetadata, SyncGroupMetadata groupMetadata, SyncSession syncSession, DataColumnCollection columns, DataRow row, IDbTransaction transaction, DataTable& dataTable, SyncStage stage)
       at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.ApplyInsertsAndHandleConflicts(DataRow row, SyncAdapter adapter, IDbCommand cmd, IDbTransaction transaction, SyncGroupMetadata groupMetadata, SyncTableMetadata tableMetadata, SyncSession syncSession, DataColumnCollection columns, Exception& error)
       at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.ApplyChangesInternal(SyncGroupMetadata groupMetadata, DataSet dataSet, SyncSession syncSession, IDbTransaction transaction, ApplyChangeType changeType)
       at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.ApplyChanges(SyncGroupMetadata groupMetadata, DataSet dataSet, SyncSession syncSession)
       at dxd.Synchronisation.Engine.SchemaAwareProvider.ApplyChanges(SyncGroupMetadata groupMetadata, DataSet dataSet, SyncSession syncSession) in D:\Projects\StockITSync\Main\Source\StockITSync\Common\dxd.Synchronization.Engine\SchemaAware\SchemaAwareProvider.cs:line 76

    Please help me if you has any solution.

    thanks
    DX
    • Moved by Max Wang_1983 Thursday, April 21, 2011 11:05 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Friday, March 6, 2009 8:20 AM

Answers

  • 1. To turn of SQL profiler can help to capture the exact TSQL which failed in execution.
    2. From this failed TSQL statement, we can look for which parameter may not have proper parameter value provided.
    3. There we can propose what to fix.

    Thanks.
    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, March 10, 2009 5:22 PM
    Answerer

All replies

  • Hi Dx,
      what version of Sync framework are you using?  Can you turn on SQL profiler to capture TSQL executed on the SQL  and find out whether

    1. the provider does not pass in the proper paramter value

    2. the parameter value is expected but TSQL failed due to table schema limitation.


    thanks
    Jandeep 

    Friday, March 6, 2009 11:07 PM
  • besides the two Questions Jandeep has, is this a SqlExpressProvider or with SqlCeClient provider ? i.e. are you sync-ing two sql db or sql db to sqlce ?

    can you provide the insertCommand's commandText and Parameterlist, this will help identify the issue.

    thanks
    Yunwen


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, March 9, 2009 12:12 AM
    Moderator
  •   thank you for your help,

    To Jandeep: I am using version of : Microsoft.Synchronization 2.0.0.0
                                                            Microsoft.Synchronization.Data 3.0.0.0
                                                            Microsoft.Synchronization.Data.Server 3.0.0.0

    I have used SQL profiler to get information about parameter value, but i cannot find any information  for creating provider.

    To Yunwen: I am using Sqlexpressprovider to sync two sql db, i think that i used SqlSyncAdapterBuilder to build adapter so i do not need to care anything else except table name.

    SqlSyncAdapterBuilder builder = new SqlSyncAdapterBuilder();

    builder.Connection = clientConnection;

    builder.ChangeTrackingType = ChangeTrackingType.SqlServerChangeTracking;

    builder.SyncDirection = _syncDirection;

    builder.TableName = tableName;

    return builder.ToSyncAdapter();

    Thanks
    DX

    Monday, March 9, 2009 5:51 AM
  • 1. To turn of SQL profiler can help to capture the exact TSQL which failed in execution.
    2. From this failed TSQL statement, we can look for which parameter may not have proper parameter value provided.
    3. There we can propose what to fix.

    Thanks.
    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, March 10, 2009 5:22 PM
    Answerer
  • hi,

    Back to this issue, notice that, this error occured on all tables that have only one Column.

    i is really worry about this because that when we using sync framework we do not care to what is column of table. 

    what do you think?

    Thanks
    DX
    Thursday, October 15, 2009 6:55 AM