Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I was able to synchronize a Merge pull subscription on SQL Server 2008 R2 Express - without the SQL Server Agent - via RMO with the following bit of C#:</p> <pre><code>static void SynchronizeMergePullSubscriptionViaRMO() { // Define the server, publication, and database names. string subscriberName = "WIN8CP\\SQLEXPRESS"; string publisherName = "WS2008R2_1"; string distributorName = "WS2008R2_1"; string publicationName = "TestMergePub2"; string subscriptionDbName = "TestSubDB1"; string publicationDbName = "AdventureWorksLT"; // Create a connection to the Subscriber. ServerConnection conn = new ServerConnection(subscriberName); MergePullSubscription subscription; MergeSynchronizationAgent agent; try { // Connect to the Subscriber. conn.Connect(); // Define the pull subscription. subscription = new MergePullSubscription(); subscription.ConnectionContext = conn; subscription.DatabaseName = subscriptionDbName; subscription.PublisherName = publisherName; subscription.PublicationDBName = publicationDbName; subscription.PublicationName = publicationName; // If the pull subscription exists, then start the synchronization. if (subscription.LoadProperties()) { // Get the agent for the subscription. agent = subscription.SynchronizationAgent; // Set the required properties that could not be returned // from the MSsubscription_properties table. agent.PublisherSecurityMode = SecurityMode.Integrated; agent.DistributorSecurityMode = SecurityMode.Integrated; agent.Distributor = publisherName; // Enable agent output to the console. agent.OutputVerboseLevel = 4; agent.Output = "C:\\TEMP\\mergeagent.log"; // Synchronously start the Merge Agent for the subscription. agent.Synchronize(); } else { // Do something here if the pull subscription does not exist. throw new ApplicationException(String.Format( "A subscription to '{0}' does not exist on {1}", publicationName, subscriberName)); } } catch (Exception ex) { // Implement appropriate error handling here. throw new ApplicationException("The subscription could not be " + "synchronized. Verify that the subscription has " + "been defined correctly.", ex); } finally { conn.Disconnect(); } } </code></pre> <p>A code sample can be downloaded from the <a href="http://code.msdn.microsoft.com/SQL-Server-Express-05c73322" rel="nofollow">MSDN Code Gallery</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload