GetQualifiedName 方法
Returns the qualified name of the variable.
命名空间: Microsoft.SqlServer.Dts.Runtime
程序集: Microsoft.SqlServer.ManagedDTS(在 Microsoft.SqlServer.ManagedDTS.dll 中)
语法
声明
Public Function GetQualifiedName ( _
variable As String _
) As String
用法
Dim instance As VariableDispenser
Dim variable As String
Dim returnValue As String
returnValue = instance.GetQualifiedName(variable)
public string GetQualifiedName(
string variable
)
public:
String^ GetQualifiedName(
String^ variable
)
member GetQualifiedName :
variable:string -> string
public function GetQualifiedName(
variable : String
) : String
参数
- variable
类型:System. . :: . .String
The variable whose fully qualified name you want to know.
返回值
类型:System. . :: . .String
The qualified name of the variable, which includes the variable name and the namespace that it belongs to.
注释
This method returns the full name of the variable, but does not lock the variable.
If the GetQualifiedName method is called by using only the name of the variable and not specifying the namespace, the method returns the first matching entry.
If this method returns the DTS_E_AMBIGUOUSVARIABLENAME method, it means that the reference is ambiguous, and you must provide a namespace together with the variable in the variable parameter. This error occurs when a variable with the same name exists in different namespaces. Specifying the namespace lets you locate the correct variable.
示例
The following code example creates a VariableDispenser and adds two system variables to the list that is locked for reading, and one system variable to the list that is locked for writing. Then the GetVariables is called to lock all three variables in the collection. The fully-qualified name of the PackageName variable is output by using GetQualifiedName.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace Microsoft.SqlServer.SSIS.Sample
{
class Program
{
static void Main(string[] args)
{
Package pkg = new Package();
Variables vars = null;
VariableDispenser variableDispenser = pkg.VariableDispenser;
variableDispenser.LockForRead("System::PackageName");
variableDispenser.LockForRead("System::OfflineMode");
variableDispenser.GetVariables(ref vars);
// Verify that the variable is locked before unlocking.
Console.WriteLine("Variables are locked? {0}", vars.Locked);
foreach (Variable myVar in vars)
{
Console.WriteLine("Name {0}", myVar.Name);
Console.WriteLine("Description {0}", myVar.Description);
Console.WriteLine();
}
// Use Contains to determine whether indexing can be used.
Boolean pkgName = variableDispenser.Contains("PackageName");
String qName = variableDispenser.GetQualifiedName("PackageName");
Console.WriteLine("Contains is valid? {0}", pkgName);
Console.WriteLine("Fully qualified name is: {0}", qName);
vars.Unlock();
Console.WriteLine("Variables are locked? {0}", vars.Locked);
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace Microsoft.SqlServer.SSIS.Sample
Class Program
Shared Sub Main(ByVal args() As String)
Dim pkg As Package = New Package()
Dim vars As Variables = Nothing
Dim variableDispenser As VariableDispenser = pkg.VariableDispenser
variableDispenser.LockForRead("System::PackageName")
variableDispenser.LockForRead("System::OfflineMode")
variableDispenser.GetVariables( vars)
' Verify that the variable is locked before unlocking.
Console.WriteLine("Variables are locked? {0}", vars.Locked)
Dim myVar As Variable
For Each myVar In vars
Console.WriteLine("Name {0}", myVar.Name)
Console.WriteLine("Description {0}", myVar.Description)
Console.WriteLine()
Next
' Use Contains to determine whether indexing can be used.
Dim pkgName As Boolean = variableDispenser.Contains("PackageName")
Dim qName As String = variableDispenser.GetQualifiedName("PackageName")
Console.WriteLine("Contains is valid? {0}", pkgName)
Console.WriteLine("Fully qualified name is: {0}", qName)
vars.Unlock()
Console.WriteLine("Variables are locked? {0}", vars.Locked)
End Sub
End Class
End Namespace
Sample Output:
Variables are locked? True
Name OfflineMode
Description The offline mode currently set for the package
Name PackageName
Description The package name
Contains is valid? True
Fully qualified name is: System::PackageName
Variables are locked? False