共用方式為


IVsDataExplorerConnectionManager.AddConnection 方法

將具有指定之屬性的新資料連接。

命名空間:  Microsoft.VisualStudio.Data.Services
組件:  Microsoft.VisualStudio.Data.Services (在 Microsoft.VisualStudio.Data.Services.dll 中)

語法

'宣告
Function AddConnection ( _
    connectionName As String, _
    provider As Guid, _
    connectionString As String, _
    encryptedString As Boolean _
) As IVsDataExplorerConnection
IVsDataExplorerConnection AddConnection(
    string connectionName,
    Guid provider,
    string connectionString,
    bool encryptedString
)
IVsDataExplorerConnection^ AddConnection(
    String^ connectionName, 
    Guid provider, 
    String^ connectionString, 
    bool encryptedString
)
abstract AddConnection : 
        connectionName:string * 
        provider:Guid * 
        connectionString:string * 
        encryptedString:bool -> IVsDataExplorerConnection
function AddConnection(
    connectionName : String, 
    provider : Guid, 
    connectionString : String, 
    encryptedString : boolean
) : IVsDataExplorerConnection

參數

  • connectionName
    類型:String

    資料連接的名稱。

  • provider
    類型:Guid

    DDEX 提供者的 GUID。

  • connectionString
    類型:String

    連接字串,以未加密或加密的形式,包含連接屬性。

  • encryptedString
    類型:Boolean

    指出是否將 Boolean 值 connectionString 參數加密 (true) (false)。

傳回值

類型:Microsoft.VisualStudio.Data.Services.IVsDataExplorerConnection
表示新資料連接的 IVsDataExplorerConnection 物件。

備註

當您建立新的連接時,資料連接的預設名稱在 Visual Studio 伺服器總管的是包含伺服器名稱、資料庫名稱和結構描述的複合字串。 不過,您可以提供自訂名稱資料連接。 這個方法可讓您設定資料連接名稱。

.NET Framework 安全性

請參閱

參考

IVsDataExplorerConnectionManager 介面

Microsoft.VisualStudio.Data.Services 命名空間