TaskHost.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

식입니다.

구현

예제

다음 코드 예제에서는 사용 하는 SetExpression 방법 및 GetExpression 메서드를 보여 줍니다 TaskHost. 이 코드 예제의 경우 호스트된 작업은 .입니다 BulkInsertTask.

using System;  
using System.Collections.Generic;  
using System.Text;  
using Microsoft.SqlServer.Dts.Runtime;  
using Microsoft.SqlServer.Dts.Tasks.BulkInsertTask;  

namespace Microsoft.SqlServer.SSIS.Sample  
{  
    class Program  
        {  
        static void Main(string[] args)  
        {  
            Package pkg = new Package();  
            TaskHost th = (TaskHost)pkg.Executables.Add("STOCK:BulkInsertTask");  

            // View information about the CheckConstraints property  
            // before setting it using the SetExpression method.  
            Boolean checkConstraint = (Boolean)th.Properties["CheckConstraints"].GetValue(th);  
            Console.WriteLine("Original value of CheckConstraints: {0}", checkConstraint);  

            // Use SetExpression to set the value to true.  
            String myTrueString = "true";  
            th.Properties["CheckConstraints"].SetExpression(th, myTrueString);  

            // 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.  
            checkConstraint = (Boolean)th.Properties["CheckConstraints"].GetValue(th);  
            String myExpression = th.Properties["CheckConstraints"].GetExpression(th);  
            Console.WriteLine("New value of CheckConstraints: {0}", checkConstraint);  
            Console.WriteLine("Expression for CheckConstraints: {0}", myExpression);  
        }  
    }  
}  

샘플 출력:

CheckConstraints의 원래 값: False

CheckConstraints의 새 값: True

CheckConstraints 식: true

설명

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

적용 대상