学习.Net  
C#
SqlCeReplication repl = null;
try
{
// Create SqlCeReplication instance
//
repl = new SqlCeReplication();
repl.InternetUrl = "http://www.adventure-works.com/sqlmobile/sqlcesa30.dll";
repl.InternetLogin = "MyInternetLogin";
repl.InternetPassword = "<password>";
repl.Publisher = "MyPublisher";
repl.PublisherDatabase = "MyPublisherDatabase";
repl.PublisherLogin = "MyPublisherLogin";
repl.PublisherPassword = "<password>";
repl.Publication = "MyPublication";
repl.Subscriber = "MySubscriber";
repl.SubscriberConnectionString = "Data Source=MyDatabase.sdf";
// Mark the subscription for reinitialization with Upload first
//
 repl.ReinitializeSubscription(true); //必须保证订阅存在,否则会出现错误
// Synchronize to the SQL Server to populate the Subscription 
//
repl.Synchronize();
}
catch (SqlCeException)
{
// Handle errors here
}
finally
{
// Dispose the repl object
//
repl.Dispose();
}
posted on 2007-03-26 20:18  没有空气  阅读(310)  评论(0编辑  收藏  举报
 
同时有 个用户访问
hit statistics