Common SQL Distribution Control and SQL Merge Control Functionality
The SQL Distribution control and SQL Merge control have common functionality. This functionality includes:
- Adding subscriptions.
- Registering subscriptions in Microsoft® Windows Synchronization Manager.
- Copying subscriptions.
- Dropping subscriptions.
Note This functionality applies only to existing pull and anonymous subscriptions. It cannot be used for push subscriptions.
Adding Subscriptions
The SQLDistribution and SQLMerge objects can be configured to add subscriptions using the AddSubscription method. When adding a subscription, you can specify to create the Subscriber database, use an existing database, attach a database .mdf file, register an existing subscription, or attach a subscription .msf file.
To add a pull subscription, the Subscriber must already be defined at the Publisher.
Explicitly adding a subscription for an anonymous Subscriber is optional.
Registering Subscriptions
In addition to adding the subscription, the subscription can be registered in Microsoft Windows Synchronization Manager using the AddSubscription method. After being registered, there is no need to use the Microsoft ActiveX® replication controls to synchronize the Subscriber because you can perform this operation using the Microsoft Windows Synchronization Manager. The Windows Synchronization Manager can be accessed from the Start menu by clicking Programs, clicking Accessories, then clicking Synchronize.
To register a subscription in Windows Synchronization Manager, specify SYNC_MANAGER (instead of the default NONE) for the second argument of AddSubscription.
Copying Subscriptions
The SQLDistribution and SQLMerge objects can be used to copy a specially prepared database subscription file (typically with an .msf extension) to a Subscriber, attach the subscription, and receive an immediately synchronized subscription at the original Publisher. The CopySubscription method creates the .msf file. The AddSubscription method with the ATTACH_SUBSCRIPTION option creates the new subscription from the .msf file.
Dropping Subscriptions
The SQLDistribution and SQLMerge objects can be programmed to drop subscriptions using the DropSubscription method. When removing the subscription, you can specify if the Subscriber database should be dropped. You can also specify that the subscription be unregistered from Microsoft Windows Synchronization Manager, but not dropped by specifying UNREGISTER_SUBSCRIPTION for the parameter of DropSubscription.