다음을 통해 공유


Variables.Add Method

Adds a Variable object to the Variables collection.

네임스페이스: Microsoft.SqlServer.Dts.Runtime
어셈블리: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

구문

‘선언
Public Function Add ( _
    name As String, _
    readOnly As Boolean, _
    nameSpace As String, _
    val As Object _
) As Variable
public Variable Add (
    string name,
    bool readOnly,
    string nameSpace,
    Object val
)
public:
Variable^ Add (
    String^ name, 
    bool readOnly, 
    String^ nameSpace, 
    Object^ val
)
public Variable Add (
    String name, 
    boolean readOnly, 
    String nameSpace, 
    Object val
)
public function Add (
    name : String, 
    readOnly : boolean, 
    nameSpace : String, 
    val : Object
) : Variable

매개 변수

  • name
    The name of the package, task, or container variable to add to the collection.
  • readOnly
    A Boolean that indicates whether the variable is read-only or whether the variable can be modified.
  • nameSpace
    The namespace for the variable. Default value is the User variable namespace. You can also create a namespace to identify variables you create that are used in a certain part of a package. You cannot add variables to the System variable namespace.
  • val
    The design-time value of the variable.

반환 값

The newly created variable that was added to the Variables collection.

주의

For more information, see 패키지에서 변수 사용.

The following example creates a package, and adds a variable, myVar, to its variable collection.

static void Main(string[] args)
        {
            Package p = new Package();
            //Add a variable, myvar, to the package variables
            // collection. The variable has a value of 5, in the myNamespace
            // namespace.
            Variable var = p.Variables.Add("myVar", false, "myNamespace", 5);
            //
            // Enter the rest of your code here.
            //
        }
Shared  Sub Main(ByVal args() As String)
            Dim p As Package =  New Package() 
            'Add a variable, myvar, to the package variables
            ' collection. The variable has a value of 5, in the myNamespace
            ' namespace.
            Dim var As Variable =  p.Variables.Add("myVar",False,"myNamespace",5) 
            '
            ' Enter the rest of your code here.
            '
End Sub

스레드 보안

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

플랫폼

개발 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

대상 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

참고 항목

참조

Variables Class
Variables Members
Microsoft.SqlServer.Dts.Runtime Namespace