我在VS 2017中遇到了Sync Framework 2.1的麻烦。我有一个本地数据库(SQL CE 4.0)和一个远程(SQL SERVER 2012)。我只是想同步它,所以我写了:
Dim serverConn As New SqlConnection("Initial Catalog=DIVACOMWSSRV_USER_AIP;" &
"Data Source=VSRV-DEV\MSSQLSERVER2012;Integrated Security=SSPI;")
Dim scopeDesc As DbSyncScopeDescription = New DbSyncScopeDescription("AIP_USER")
Dim tableDesc As DbSyncTableDescription = SqlSyncDescriptionBuilder.GetDescriptionForTable("AIP_USER", serverConn)
scopeDesc.Tables.Add(tableDesc)
Dim serverProvision As SqlSyncScopeProvisioning = New SqlSyncScopeProvisioning(serverConn, scopeDesc)
If Not serverProvision.ScopeExists("AIP_USER") Then
serverProvision.SetCreateTableDefault(DbSyncCreationOption.Skip)
serverProvision.Apply()
End If
Dim clientConn As SqlCeConnection = New SqlCeConnection("Data Source=" & Application.StartupPath & "\Data\DWSU.sdf")
scopeDesc = SqlSyncDescriptionBuilder.GetDescriptionForScope("AIP_USER", serverConn)
Dim clientProvision As SqlCeSyncScopeProvisioning = New SqlCeSyncScopeProvisioning(clientConn, scopeDesc)
If Not clientProvision.ScopeExists("AIP_USER") Then
clientProvision.Apply()
End If
Dim myConnDist = serverConn
Dim myConnLocal = clientConn
Dim myLocalSP As New SqlCeSyncProvider("AIP_USER", myConnLocal)
Dim myDistSP As New SqlSyncProvider("AIP_USER", myConnDist)
Dim agent As New SyncOrchestrator
agent.Direction = SyncDirectionOrder.UploadAndDownload
agent.LocalProvider = myLocalSP
agent.RemoteProvider = myDistSP
Dim syncOstats As SyncOperationStatistics = agent.Synchronize()
为了简单起见,我将我的范围命名为我的表格。 代码一直有效,直到
Dim syncOstats As SyncOperationStatistics = agent.Synchronize()
错误: - $ exception {“Impossible de trouver unevaleuràdéfinirpourleparamètredecommande'@ P_6'.Assurez-vous quelesschémasdestables en cours de synchronizationsontcohérents,et que la configuration decetteétendueestcorrecte。”} Microsoft .Synchronization.Data.DbSyncException
所以:
无法找到要为@ P_6参数定义的值。确保正在同步的表模式是正确的,并且范围名是正确的。
除了,两张桌子都没有6个参数,但是5.我正在挠头,我检查了两个范围,只有5个参数,它们是正确的。
有没有人遇到过这个例外?
答案 0 :(得分:0)
更新:我的不好,太快了......由于一个未知的原因,我的遥远的桌子上缺少一个专栏,所以这就是他要求第6个参数的原因。