try{string strPublisher, strDistributor, strSubscriber, strPublisherDatabase, strSubscriberDatabase, strPublication;strPublisher = "Pluto"; // name of your publisherstrDistributor = "Pluto"; // name of your distributorstrSubscriber = Environment.MachineName+"\\MSDE"; // name of your subscriberstrPublication = "TestConf";strPublisherDatabase = "TestConf";strSubscriberDatabase = "TestConf";SQLMergeClass oMerge = new SQLMergeClass();//Set up the Publisher.oMerge.Publisher = strPublisher;oMerge.PublisherSecurityMode = SQLMERGXLib.SECURITY_TYPE.NT_AUTHENTICATION;oMerge.PublisherDatabase = strPublisherDatabase;oMerge.Publication = strPublication;//Set up the Distributor.oMerge.Distributor = strDistributor;oMerge.DistributorSecurityMode = SQLMERGXLib.SECURITY_TYPE.NT_AUTHENTICATION;//Set up the Subscriber.oMerge.Subscriber = strSubscriber;oMerge.SubscriberDatasourceType = 0;oMerge.SubscriberDatabase = strSubscriberDatabase;oMerge.SubscriberSecurityMode = SQLMERGXLib.SECURITY_TYPE.NT_AUTHENTICATION;//Set up the subscription.oMerge.SubscriptionType = SQLMERGXLib.SUBSCRIPTION_TYPE.ANONYMOUS;oMerge.SynchronizationType = SQLMERGXLib.SYNCHRONIZATION_TYPE.AUTOMATIC;// oMerge.SubscriptionName = "PullMergeSubscription";//Create the database and subscription.oMerge.AddSubscription(SQLMERGXLib.DBADDOPTION.CREATE_DATABASE, SQLMERGXLib.SUBSCRIPTION_HOST.NONE);//Synchronize the subscription. Console.WriteLine("Starting synchronization...");oMerge.Initialize();oMerge.Run();oMerge.Terminate();Console.WriteLine("Synchronization completed.");}catch (Exception e){Console.WriteLine(e.StackTrace);Console.WriteLine(e.Message);}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货