Sdílet prostřednictvím


Task.GetConnectionID(Connections, String) Method

Definition

Gets a String containing the ID of the connection.

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

Parameters

connections
Connections

The Connections collection to review.

nameOrID
String

The name of the connection to return.

Returns

A String containing the connection's ID.

Examples

The following code example shows an example of a task that uses 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