共用方式為


ReplicationServer.AttachSubscriptionDatabase Method

Definition

Attaches a copied subscription database at the Subscriber.

public:
 void AttachSubscriptionDatabase(System::String ^ databaseName, System::String ^ fileName, Microsoft::SqlServer::Replication::ConnectionSecurityContext ^ subscriberSecurity);
public void AttachSubscriptionDatabase (string databaseName, string fileName, Microsoft.SqlServer.Replication.ConnectionSecurityContext subscriberSecurity);
member this.AttachSubscriptionDatabase : string * string * Microsoft.SqlServer.Replication.ConnectionSecurityContext -> unit
Public Sub AttachSubscriptionDatabase (databaseName As String, fileName As String, subscriberSecurity As ConnectionSecurityContext)

Parameters

databaseName
String

A string value that specifies the name of the database being attached.

fileName
String

A string value that specifies the complete path to, and the file name of, the data (.mdf) file being attached.

subscriberSecurity
ConnectionSecurityContext

A ConnectionSecurityContext that specifies the connection context that is used to establish a connection with the Subscriber.

Exceptions

When the Subscriber is not running on SQL Server 2000 or later.

If string parameters are null, contain null characters, or are too long.

If the subscriberSecurity parameter is null.

Remarks

The AttachSubscriptionDatabase method can be called by members of the sysadmin fixed server role.

The AttachSubscriptionDatabase method is equivalent to executing sp_attachsubscription (Transact-SQL).

Applies to