The AddSubscription method adds a new subscription based on the specified control properties.
| SQLDistribution Object | SQLMerge Object |
object.AddSubscription(DBADDOPTION, SubscriptionHost)
| Part | Description |
|---|---|
| object | Expression that evaluates to an object in the Applies To list |
| DBADDOPTION | Option to add |
| SubscriptionHost | Subscription host |
Push subscriptions are not currently supported by this method.
If DBADDOPTION is set to ATTACK_DATABASE and SubscriberDatasourceType is set to SQL_SERVER, AddSubscription can only work with single-file databases.
| Return code | Description |
|---|---|
| S_OK | Method succeeded. |
| E_FAIL | General failure occurred. Check error records for detailed information. |
| REPLX_E_DBEXISTS | Specified database already exists. |
| REPLX_E_DBNOTFOUND | Specified database does not exist. |
| REPLX_E_SUBEXISTS | Specified subscription already exists. |
| REPLX_E_RETRYFAILURE | Failure occurred that may require retrying the last operation. |
HRESULT AddSubscription(
DBADDOPTION DBAddOption,
SUBSCRIPTION_HOST SubscriptionHost);