nikko
August 21st, 2008, 05:23 AM
Hi!
I've (almost) successfully setup merge replication. The thing is, when I synchronize, my mobile device just downloads data from the server and doesn't upload the changes I made to the CE database.
I'm using VS2003, and the following is my code to sync:
try
{
rep = new SqlCeReplication();
rep.InternetUrl = "http://as0203799/sam/sscesa20.dll";
rep.Publisher = "as0203799";
rep.PublisherDatabase = "Northwind";
rep.PublisherLogin = "test";
rep.PublisherPassword = "test";
rep.Publication = "Northwind_SDF2" ;
rep.Subscriber = "sam" ;
rep.SubscriberConnectionString = "Data Source=\\sam.sdf;SSCE:Database Password=x";
rep.ExchangeType=ExchangeType.BiDirectional;
if(System.IO.File.Exists("\\sam.sdf"))
{
rep.AddSubscription(AddOption.ExistingDatabase);
}
else
rep.AddSubscription(AddOption.CreateDatabase);
rep.Synchronize();
MessageBox.Show(rep.SubscriberChanges.ToString());
MessageBox.Show("Sync complete");
rep.DropSubscription(DropOption.LeaveDatabase);
MessageBox.Show("subscription dropped");
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
I'd really appreciate any form of push towards the right direction. Thank you very much!
I've (almost) successfully setup merge replication. The thing is, when I synchronize, my mobile device just downloads data from the server and doesn't upload the changes I made to the CE database.
I'm using VS2003, and the following is my code to sync:
try
{
rep = new SqlCeReplication();
rep.InternetUrl = "http://as0203799/sam/sscesa20.dll";
rep.Publisher = "as0203799";
rep.PublisherDatabase = "Northwind";
rep.PublisherLogin = "test";
rep.PublisherPassword = "test";
rep.Publication = "Northwind_SDF2" ;
rep.Subscriber = "sam" ;
rep.SubscriberConnectionString = "Data Source=\\sam.sdf;SSCE:Database Password=x";
rep.ExchangeType=ExchangeType.BiDirectional;
if(System.IO.File.Exists("\\sam.sdf"))
{
rep.AddSubscription(AddOption.ExistingDatabase);
}
else
rep.AddSubscription(AddOption.CreateDatabase);
rep.Synchronize();
MessageBox.Show(rep.SubscriberChanges.ToString());
MessageBox.Show("Sync complete");
rep.DropSubscription(DropOption.LeaveDatabase);
MessageBox.Show("subscription dropped");
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
I'd really appreciate any form of push towards the right direction. Thank you very much!