Using SQL ManagementStudio 2008 I created SQL 3.5 Compact DB (TestCompact.sdf) and I have created subscription to existing Publication. Using SQL Management Studio it is working. I have transfered TestCompact.sdf to Windows Mobile 5 emulator device and with QueryAnalyzer for Mobile I could query existing tables in TestCompact.sdf. I don't know how to start replication synchronization on that mobile device. Do I need to write some C# code or it is possible do it more simple?
EDIT: (Added after reply on my question) Maybe it will be useful for someone what C# code did the job for me: (Using SQL Management Studio - Properties on existing subscription for my Compact DB) I read what are values for a replObj properties)
private void btnSync_Click(object sender, EventArgs e)
{
SqlCeConnection sqlCeConn = null;
SqlCeReplication replObj = new SqlCeReplication();
string connString = @"data source=\My Documents\TestReplicationCompactDB.sdf;Password=bero";
replObj.InternetUrl = @"http://192.168.99.99/VirtualDirectoryForCompactDBReplication/sqlcesa35.dll";;
replObj.PublisherDatabase = "TestReplicationDB";
replObj.PublisherSecurityMode = SecurityType.NTAuthentication;;
replObj.Publisher = @"DBTESTSRV\SQL2008";
replObj.Publication = "TestReplication2";
replObj.Subscriber = "TestReplication";
replObj.SubscriberConnectionString = @"data source=\My Documents\TestReplicationCompactDB.sdf;Password=bero";
replObj.InternetLogin = @"ares\intor";
replObj.InternetPassword = "intor";
try
{
sqlCeConn = new SqlCeConnection(connString);
sqlCeConn.Open();
replObj.Synchronize();
sqlCeConn.Close();
}
catch (Exception ex) {
MessageBox.Show(ex.Message);
if (sqlCeConn != null && sqlCeConn.State == ConnectionState.Open)
sqlCeConn.Close();
return;
}
string countPublisherChanges = replObj.PublisherChanges.ToString();
string countSubScriberChanges = replObj.SubscriberChanges.ToString();
MessageBox.Show(String.Format("Finished with {0} subscriber changes and with {1} publisher changes", countSubScriberChanges, countPublisherChanges));
}
You need to write "some" C# code, at the end of the Wizard in SSMS you get some sample code.