Microsoft Sync Framework“预期列”错误

时间:2016-09-29 03:07:31

标签: microsoft-sync-framework

我在过去几个月里一直使用Microsoft Sync Framework没有问题,我在数据库中添加了新列,本地数据库与服务器数据库之间的同步没有问题。最近,我在平板电脑上添加了一些新列,并在同步特定表时遇到错误:

Expected column 'foo' was not found on the DataTable to be applied to the destination table 'MyTable'.
Parameter name: dataTable
System.ArgumentException: Expected column 'foo' was not found on the DataTable to be applied to the destination table 'MyTable'.
Parameter name: dataTable
   at Microsoft.Synchronization.Data.SqlServer.SqlChangeHandler.SetColumnOrder(DataTable dataTable, Int32& updateKeyOrdinal, Int32& createKeyOrdinal)
   at Microsoft.Synchronization.Data.SqlServer.SqlChangeHandler.ApplyBulkChanges(DataTable dataTable)
   at Microsoft.Synchronization.Data.RelationalSyncProvider.ApplyChangesInternal(DbSyncScopeMetadata scopeMetadata, IDbTransaction transaction, FailedDeleteDelegate_type failedDeleteDelegate, DataSet dataSet, ChangeApplicationType applyType)
   at Microsoft.Synchronization.Data.RelationalSyncProvider.ApplyChanges(DbSyncScopeMetadata scopeMetadata, IDbTransaction applyTransaction, DataSet dataSet, DbSyncSession DbSyncSession, Boolean commitTransaction, FailedDeleteDelegate_type failedDeleteDelegate, String batchFileName, ChangeApplicationAction& action)
   at Microsoft.Synchronization.Data.RelationalSyncProvider.SingleTransactionApplyChangesAdapter.Apply(DataSet dataSet, Boolean commitTransaction, FailedDeleteDelegate_type failedDeleteDelegate, String batchFileName, ChangeApplicationAction& action)
   at Microsoft.Synchronization.Data.RelationalSyncProvider.ApplyChanges(DbSyncScopeMetadata scopeMetadata, DataSet dataSet, DbSyncSession dbSyncSession, Boolean commitTransaction)
   at Microsoft.Synchronization.Data.RelationalSyncProvider.ProcessChangeBatch(ConflictResolutionPolicy resolutionPolicy, ChangeBatch sourceChanges, Object changeDataRetriever, SyncCallbacks syncCallbacks, SyncSessionStatistics sessionStatistics)
   at Microsoft.Synchronization.KnowledgeProviderProxy.ProcessChangeBatch(CONFLICT_RESOLUTION_POLICY resolutionPolicy, ISyncChangeBatch pSourceChangeManager, Object pUnkDataRetriever, ISyncCallback pCallback, _SYNC_SESSION_STATISTICS& pSyncSessionStatistics)
   at Microsoft.Synchronization.CoreInterop.ISyncSession.Start(CONFLICT_RESOLUTION_POLICY resolutionPolicy, _SYNC_SESSION_STATISTICS& pSyncSessionStatistics)
   at Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWaySyncHelper(SyncIdFormatGroup sourceIdFormats, SyncIdFormatGroup destinationIdFormats, KnowledgeSyncProviderConfiguration destinationConfiguration, SyncCallbacks DestinationCallbacks, ISyncProvider sourceProxy, ISyncProvider destinationProxy, ChangeDataAdapter callbackChangeDataAdapter, SyncDataConverter conflictDataConverter, Int32& changesApplied, Int32& changesFailed)
   at Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWayKnowledgeSync(SyncDataConverter sourceConverter, SyncDataConverter destinationConverter, SyncProvider sourceProvider, SyncProvider destinationProvider, Int32& changesApplied, Int32& changesFailed)
   at Microsoft.Synchronization.KnowledgeSyncOrchestrator.Synchronize()
   at Microsoft.Synchronization.SyncOrchestrator.Synchronize()

我正在尝试将整个表从服务器下载到我的本地数据库。这总是有效但现在我突然得到这个错误。我的本地数据库和服务器数据库中的表foo中都有列MyTable。这个错误背后的原因是什么?

2 个答案:

答案 0 :(得分:0)

我无法找到任何解决方案,因此我最终创建了一个新数据库,运行迁移并从旧数据库导入所有数据。问题似乎出现在数据库的迁移历史中。

答案 1 :(得分:0)

配置表时,会创建相应的UDF(TVF)来表示表。运行迁移时,这可能与基表不同步。