다음을 통해 공유


Sequence.SetExpression 메서드

Assigns the specified expression to the property. Specify nullnull 참조(Visual Basic에서는 Nothing) to remove an existing expression from the property.

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

구문

‘선언
Public Sub SetExpression ( _
    propertyName As String, _
    expression As String _
)
‘사용 방법
Dim instance As Sequence 
Dim propertyName As String 
Dim expression As String

instance.SetExpression(propertyName, _
    expression)
public void SetExpression(
    string propertyName,
    string expression
)
public:
virtual void SetExpression(
    String^ propertyName, 
    String^ expression
) sealed
abstract SetExpression : 
        propertyName:string * 
        expression:string -> unit  
override SetExpression : 
        propertyName:string * 
        expression:string -> unit
public final function SetExpression(
    propertyName : String, 
    expression : String
)

매개 변수

  • propertyName
    유형: System.String
    The name of the property to which to assign the expression.

구현

IDTSPropertiesProvider.SetExpression(String, String)

주의

The propertyName can be any property available on the object.

The following code example uses SetExpression to modify the value of the Description on a Sequence container. Then GetExpression is used to retrieve the expression.

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)
        {
            const String containerName = "Sequence";
            Package pkg = new Package();
            Sequence sequence = (Sequence)pkg.Executables.Add("STOCK:Sequence");
            DtsProperties seqProps = sequence.Properties;

            // View information about the Description property
            // before setting it using the SetExpression method.
            String desc = sequence.Description;
            Console.WriteLine("Original value of Description: {0}", desc);

            // Use SetExpression to give the Sequence a description.
            String myExpression = "\"Testing " + containerName + "\""; 
            sequence.SetExpression("Description", myExpression);
            // Note that I've tried using the Properties bag instead, with no change to the results.
            //seqProps["Description"].SetExpression(sequence, myExpression); 

            //Validate the package to set the expression onto the property.
            DTSExecResult valResult = pkg.Validate(null, null, null, null);

            // Retrieve the new value and the expression.
            String myNewDesc = sequence.Description;
            String myNewExpression = sequence.GetExpression("Description");
            Console.WriteLine("New value of Description: {0}", myNewDesc);
            Console.WriteLine("Expression for Description: {0}", myNewExpression);
        }
    }
}

Sample Output:

Original value of Description:

New value of Description: Testing Sequence

Expression for Description: "Testing Sequence"

참고 항목

참조

Sequence 클래스

Microsoft.SqlServer.Dts.Runtime 네임스페이스