To support deployment of subscriptions without the need for Transact-SQL scripts or SQL-DMO programs, the Microsoft® ActiveX® replication controls support:
The ActiveX replication controls can be programmed to add new subscriptions using the AddSubscription method. When creating a subscription, you can specify whether to create the Subscriber database, use an existing database, or attach a database.
To create a pull subscription, the Subscriber must already be defined at the Publisher.
Explicitly adding a subscription for an anonymous Subscriber is optional.
The ActiveX replication controls can be programmed to drop subscriptions using the DropSubscription method. When removing the subscription, you can specify whether the Subscriber database should also be dropped.
In addition to creating the subscription, the subscription can be registered in the Microsoft Windows Synchronization Manager using the AddSubscription method. After being registered, there is no need to use the replication ActiveX controls to synchronize the Subscriber because you can perform this operation using the Microsoft Windows NT Synchronization Manager.
In addition to dropping the subscription, the DropSubscription method unregisters the subscription from the Microsoft Windows Synchronization Manager.
This example demonstrates how a Microsoft Visual Basic® program can configure the SQL Distribution control to create an anonymous subscription, to be hosted by the Microsoft Windows NT Synchronization Manager:
'Initialize the replication control.
Dim oSQLDistribution As New SQLDistribution
'Configure the control for an anonymous subscription.
oSQLDistribution.Publisher = "PublisherName"
oSQLDistribution.PublisherDatabase = "PublisherDatabaseName"
oSQLDistribution.Publication = "PublicationName"
oSQLDistribution.PublisherSecurityMode = DB_AUTHENTICATION
oSQLDistribution.PublisherLogin = "Login"
oSQLDistribution.PublisherPassword = "Password"
oSQLDistribution.SubscriberDatasourceType = SQL_SERVER
oSQLDistribution.Subscriber = "SubscriberName"
oSQLDistribution.SubscriberDatabase = "SubscriberDatabaseName"
oSQLDistribution.SubscriptionType = ANONYMOUS
oSQLDistribution.SubscriberSecurityMode = DB_AUTHENTICATION
oSQLDistribution.SubscriberLogin = "Login"
oSQLDistribution.SubscriberPassword = "Password"
'Add the subscription, create the Subscriber database, and
'register it in Microsoft Windows Synchronization Manager
oSQLDistribution.SubscriptionName = "SampleSubscription"
oSQLDistribution.AddSubscription CREATE_DATABASE, SYNC_MANAGER
The following code would drop the subscription having the above properties:
'Drop the subscription, drop the Subscriber database, and unregister it ‘from the Microsoft Windows Synchronization Manager
oSQLDistribution.DropSubscription DROP_DATABASE
Note The above properties are the same for both the SQL Merge and SQL Distribution controls. You can replace references to the SQLDistribution object with references to the SQLMerge object.
AddSubscription Method | DropSubscription Method |