Last post Jun 07, 2017 03:17 AM by EvenMa
Jun 06, 2017 02:19 PM|abfrank|LINK
Am trying to use Microsoft Sync Framework to synchronize two SQL server databases, one sql server database is on my local pc and one is on the remote server. while trying to run the synchronization get the below error.
The current operation could not be completed because the database is not provisioned for sync or you not have permissions to the sync configuration tables.
below is my code
SqlConnection conlC = new SqlConnection();
SqlConnection clientConn = new SqlConnection(ConfigurationManager.ConnectionStrings["SMSInventory"].ConnectionString);
// create a connection to the SyncDB server database
SqlConnection serverConn = new SqlConnection(ConfigurationManager.ConnectionStrings["SMSInventoryRemote"].ConnectionString);
// create the sync orhcestrator
SyncOrchestrator syncOrchestrator = new SyncOrchestrator();
// set local provider of orchestrator to a CE sync provider associated with the
// ProductsScope in the SyncCompactDB compact client database
syncOrchestrator.LocalProvider = new SqlSyncProvider("ProductsScope", clientConn);
// set the remote provider of orchestrator to a server sync provider associated with
// the ProductsScope in the SyncDB server database
syncOrchestrator.RemoteProvider = new SqlSyncProvider("ProductsScope", serverConn);
// set the direction of sync session to Upload and Download
syncOrchestrator.Direction = SyncDirectionOrder.UploadAndDownload;
// subscribe for errors that occur when applying changes to the client
// ((SqlCeSyncProvider)syncOrchestrator.LocalProvider).ApplyChangeFailed += new EventHandler<DbApplyChangeFailedEventArgs>(Program_ApplyChangeFailed);
// execute the synchronization process
SyncOperationStatistics syncStats = syncOrchestrator.Synchronize();
Jun 07, 2017 02:21 AM|wmec|LINK
You can try to create different Connection which is something like
<add name="conn2" connectionString="Data Source=192.168.?.?\your_db_instance;Initial Catalog=your_db_schema;Integrated Security=False;User ID=your_db_login;Password=??????" providerName="System.Data.SqlClient"/>
within Web.config/app.config file in your project.
Jun 07, 2017 03:17 AM|EvenMa|LINK
According to the error message, I feels there has no problem on your code, might there has some problems on the configuration of Microsoft Sync Framework or the users which you used to login the database server has not enough permissions to access the
I suggest you could check the following points.
(1)Could you install the same version Microsoft Sync Framework both on the local and remote computer?
(2)Make sure the database which you want to sync have the same scheme(table and columns are all need to be same) both on local and remote.
(3)Check the user which you used to login the database sever has enough permissions the access the database(I suggest you could use the user of sa to login database server).
If you have any other questions, please feel free to contact me any time.