我正在尝试在我的移动和数据库服务器之间创建同步。我正在关注本教程,它进入ArgumentNullException Value can not be null.
Parameter name: ServerSyncProvider
了 sych() 函数。
代码
private void Sync()
{
Cursor.Current = Cursors.WaitCursor;
WebReference.NorthwindCacheSyncService svcProxy = new WebReference.NorthwindCacheSyncService();
Microsoft.Synchronization.Data.ServerSyncProviderProxy syncProxy =
new Microsoft.Synchronization.Data.ServerSyncProviderProxy(svcProxy);
// Call SyncAgent.Synchronize() to initiate the synchronization process.
// Synchronization only updates the local database, not your project's data source.
NorthwindCacheSyncAgent syncAgent = new NorthwindCacheSyncAgent();
Microsoft.Synchronization.Data.SyncStatistics syncStats = syncAgent.Synchronize();
// TODO: Reload your project data source from the local database (for example, call the TableAdapter.Fill method).
// Show synchronization statistics
MessageBox.Show("Changes downloaded: " + syncStats.TotalChangesDownloaded.ToString()
+ "\r\nChanges Uploaded: " + syncStats.TotalChangesUploaded.ToString());
Cursor.Current = Cursors.Default;
}