Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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
'Declaration
Public MustOverride Function AddConnection ( _
    connectionName As String, _
    provider As Guid, _
    connectionString As String, _
    encryptedString As Boolean _
) As DataExplorerConnection
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
abstract AddConnection : 
        connectionName:string * 
        provider:Guid * 
        connectionString:string * 
        encryptedString:bool -> DataExplorerConnection
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 nulla 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.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.