Here is the C# code to create a SQL Server Compact Edition (formerly known as
SQL Server Everywhere and SQL Server Mobile) programmatically with hostname
filtering:
SqlCeReplication repl;
try
{
// Instantiate and configure SqlCeReplication object.
//
repl = new SqlCeReplication();
repl.InternetUrl = "
http://www.websyncurl.com/sqlcesa30.dll"; repl.InternetLogin = internetLogin;
repl.InternetPassword = internetPassword;
repl.Publisher = publisher;
repl.PublisherSecurityMode = SecurityType.NTAuthentication;
repl.PublisherDatabase = publisherDatabase;
repl.Publication = publication;
repl.Subscriber = subscriber;
repl.SubscriberConnectionString = "Data Source=MyDatabase.sdf";
repl.HostName = hostname;
// Create a local SQL Server Compact database and subscription.
//
repl.AddSubscription(AddOption.CreateDatabase);
// Initialize the subscription.
//
repl.Synchronize();
}
catch (SqlCeException)
{
// Handle errors here
//
}
For more info, see these topics :
http://msdn2.microsoft.com/en-us/library/ms171908.aspx http://msdn2.microsoft.com/en-us/library/ms365205.aspx --
Glenn Gailey [MS]
SQL Server User Education
This posting is provided "AS IS" with no warranties, and confers no rights.
[quoted text, click to view] "Ming Yeung" wrote:
> Things I got to work
> SQL2K, Merge Publication -> SQL Everywhere (I used the interface in SQL2K5
> to do this Subscribe, can anyone show me how to do it in C# 2005 code???)
>
> SQL2k Merge Publication with Dynamic filters(i.e SUSER_SNAME) -> To Another
> instance of SQL2k
>
> What I would like to know is how to I get dynamic filters/dynamic snapshots
> on rows to work with SQL Everywhere and is this even supported?
>