Bagikan melalui


Task.GetConnectionName Method

Gets a String containing the name of the connection.

Namespace:  Microsoft.SqlServer.Dts.Runtime
Assembly:  Microsoft.SqlServer.ManagedDTS (in Microsoft.SqlServer.ManagedDTS.dll)

Syntax

'Declaration
Public Function GetConnectionName ( _
    connections As Connections, _
    nameOrID As String _
) As String
'Usage
Dim instance As Task
Dim connections As Connections
Dim nameOrID As String
Dim returnValue As String

returnValue = instance.GetConnectionName(connections, _
    nameOrID)
public string GetConnectionName(
    Connections connections,
    string nameOrID
)
public:
String^ GetConnectionName(
    Connections^ connections, 
    String^ nameOrID
)
member GetConnectionName : 
        connections:Connections * 
        nameOrID:string -> string 
public function GetConnectionName(
    connections : Connections, 
    nameOrID : String
) : String

Parameters

  • nameOrID
    Type: System.String
    The ID of the connection to return.

Return Value

Type: System.String
A String containing the connection's name.

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.

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