Sequence.SetExpression(String, String) 메서드

정의

지정한 식을 속성에 할당합니다. 속성에서 기존 식을 제거하려면 null을 지정합니다.

public:
 virtual void SetExpression(System::String ^ propertyName, System::String ^ expression);
public void SetExpression (string propertyName, string expression);
abstract member SetExpression : string * string -> unit
override this.SetExpression : string * string -> unit
Public Sub SetExpression (propertyName As String, expression As String)

매개 변수

propertyName
String

식을 할당할 속성의 이름입니다.

expression
String

식입니다.

구현

예제

다음 코드 예제에서는 컨테이너의 값을 수정하는 DescriptionSequence 데 사용합니다SetExpression. 그런 다음 GetExpression 식을 검색하는 데 사용됩니다.

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);  
        }  
    }  
}  

샘플 출력:

설명의 원래 값:

설명의 새 값: 시퀀스 테스트

설명 식: "시퀀스 테스트"

설명

개체 propertyName 에서 사용할 수 있는 모든 속성일 수 있습니다.

적용 대상