我的PC操作系统为:windowsServer2003 SP2,数据库为:SQL Server 2000 .我在PC上发布了一个数据库的内容,快照也生成了,选的是: "合并复制 "的发布类型.
移动设备操作系统:WinCE 4.2.下载的工具为:SQLServer CE2000,补丁为:SP4,Server Tools 也装了,我按照网上的一些例子,进行了操作,并在移动终端写下如下代码:
// 实例化并配置 SqlCeReplication 对象
SqlCeReplication repl = new SqlCeReplication();
try
{
repl.InternetUrl = "http://SDF/sqlce2000/sscesa20.dll ";
repl.InternetLogin = " ";
repl.InternetPassword = " ";
repl.Publisher = "sdf ";
repl.PublisherDatabase = "PubsCopy ";
repl.PublisherLogin = "sa ";
repl.PublisherPassword = " ";
repl.Publication = "PubsCopy:PubsCopy ";
repl.Subscriber = "MySubscriber ";
repl.SubscriberConnectionString = "Data Source=MyDatabase.sdf ";
// 创建一个本地 SQL Server Mobile 数据库的订阅
repl.AddSubscription(AddOption.CreateDatabase);
// 跟 SQL Server 数据库进行同步
repl.Synchronize();
}
catch (Exception e)
{
throw e;