DataExplorerConnectionManager.AddConnection Method

Adds a new connection to the Server Explorer window with the specified connection settings.

Namespace:  Microsoft.VisualStudio.Data
Assembly:  Microsoft.VisualStudio.Data (in Microsoft.VisualStudio.Data.dll)

Syntax

'宣言
Public MustOverride Function AddConnection ( _
    connectionName As String, _
    provider As Guid, _
    connectionString As String, _
    encryptedString As Boolean _
) As DataExplorerConnection
'使用
Dim instance As DataExplorerConnectionManager
Dim connectionName As String
Dim provider As Guid
Dim connectionString As String
Dim encryptedString As Boolean
Dim returnValue As DataExplorerConnection

returnValue = instance.AddConnection(connectionName, _
    provider, connectionString, encryptedString)
public abstract DataExplorerConnection AddConnection(
    string connectionName,
    Guid provider,
    string connectionString,
    bool encryptedString
)
public:
virtual DataExplorerConnection^ AddConnection(
    String^ connectionName, 
    Guid provider, 
    String^ connectionString, 
    bool encryptedString
) abstract
public abstract function AddConnection(
    connectionName : String, 
    provider : Guid, 
    connectionString : String, 
    encryptedString : boolean
) : DataExplorerConnection

Parameters

  • connectionName
    Type: System.String

    The initial name to use for the root connection node. If a null reference (Nothing in Visual Basic), a generated name is used.

  • provider
    Type: System.Guid

    The unique identifier of a data provider.

  • connectionString
    Type: System.String

    An unencrypted or encrypted string containing connection information.

  • encryptedString
    Type: System.Boolean

    An indication whether the connectionString parameter is unencrypted or encrypted.

Return Value

Type: Microsoft.VisualStudio.Data.DataExplorerConnection

Returns a DataExplorerConnection object instance with specified setting, representing a new connection (or existing connection if a connection with equivalent settings already exists).

Exceptions

Exception Condition
ArgumentNullException

The connectionString parameter is null.

ArgumentException

The provider is not a registered DDEX provider.

Remarks

Other exceptions indicate that a provider-specific problem occurred when adding the connection to the data explorer.

Permissions

See Also

Reference

DataExplorerConnectionManager Class

DataExplorerConnectionManager Members

Microsoft.VisualStudio.Data Namespace