共用方式為


Task.GetConnectionName(Connections, String) Method

Definition

Gets a String containing the name of the connection.

public:
 System::String ^ GetConnectionName(Microsoft::SqlServer::Dts::Runtime::Connections ^ connections, System::String ^ nameOrID);
public string GetConnectionName (Microsoft.SqlServer.Dts.Runtime.Connections connections, string nameOrID);
member this.GetConnectionName : Microsoft.SqlServer.Dts.Runtime.Connections * string -> string
Public Function GetConnectionName (connections As Connections, nameOrID As String) As String

Parameters

connections
Connections

The Connections collection to review.

nameOrID
String

The ID of the connection to return.

Returns

A String containing the connection's name.

Examples

The following code example shows an example of a task using the GetConnectionID method to get and set the names and ID of the connection in the task's custom myConnection property.

public string myConnection   
  {  
      get  
          {return GetConnectionName(m_connections, m_ MyConnectionName);  
          }  
      set  
          {m_MyConnectionName = GetConnectionID(m_connections, value);}  
    }  
Public Property myConnection() As String  
  Get   
              Return GetConnectionName(m_connections, m_ MyConnectionName)  
  End Get  
  Set (ByVal Value As String)   
              m_MyConnectionName = GetConnectionID(m_connections, value)  
  End Set  
End Property  

Remarks

This function is useful when if you are writing a custom task, and want to convert between the connection ID and the connection name.

Applies to