DtsEventHandler.GetExpression(String) 메서드

정의

지정한 속성에 대한 식을 반환합니다. Null은 식이 할당되지 않음을 의미합니다.

public:
 virtual System::String ^ GetExpression(System::String ^ propertyName);
public string GetExpression (string propertyName);
abstract member GetExpression : string -> string
override this.GetExpression : string -> string
Public Function GetExpression (propertyName As String) As String

매개 변수

propertyName
String

해당 식을 확인하려는 속성의 이름입니다.

반환

속성을 평가하는 데 사용되는 식을 포함하는 문자열입니다.

구현

예제

다음 코드 예제에서는 패키지를 만들고 패키지 이벤트에 대해 OnError 추가 DtsEventHandler 합니다. 사용 하 SetExpression여 속성이 FailParentOnFailure 수정됩니다. 메서드를 GetExpression 사용하여 새 값과 연결된 식이 표시됩니다.

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

namespace Microsoft.SqlServer.SSIS.Sample  
{  
    class SSISProgram  
    {  
        static void Main(string[] args)  
        {  
            Package pkg = new Package();  
            // Set up a DtsEventHandler for the package OnError event.  
            DtsEventHandler dtsEH = (DtsEventHandler)pkg.EventHandlers.Add("OnError");  

            // Show the value of DebugMode on the container before modifying it.  
            Console.WriteLine("Original FailParentOnFailure = {0}", dtsEH.FailParentOnFailure);  

            // Use SetExpression to set DebugMode to "true".  
            String myExpression = "True";  
            dtsEH.SetExpression("FailParentOnFailure", 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 myNewExpression = dtsEH.GetExpression("FailParentOnFailure");  
            Console.WriteLine("New value of FailParentOnFailure: {0}", dtsEH.FailParentOnFailure);  
            Console.WriteLine("Expression for FailParentOnFailure: {0}", myNewExpression);  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  

Class SSISProgram  

    Shared Sub Main(ByVal args() As String)   
        Dim pkg As New Package()  
        ' Set up a DtsEventHandler for the package OnError event.  
        Dim dtsEH As DtsEventHandler = CType(pkg.EventHandlers.Add("OnError"), DtsEventHandler)  

        ' Show the value of DebugMode on the container before modifying it.  
        Console.WriteLine("Original FailParentOnFailure = {0}", dtsEH.FailParentOnFailure)  

        ' Use SetExpression to set DebugMode to "true".  
        Dim myExpression As String = "True"  
        dtsEH.SetExpression("FailParentOnFailure", myExpression)  

        'Validate the package to set the expression onto the property.  
        Dim valResult As DTSExecResult = pkg.Validate(Nothing, Nothing, Nothing, Nothing)  

        ' Retrieve the new value and the expression.  
        Dim myNewExpression As String = dtsEH.GetExpression("FailParentOnFailure")  
        Console.WriteLine("New value of FailParentOnFailure: {0}", dtsEH.FailParentOnFailure)  
        Console.WriteLine("Expression for FailParentOnFailure: {0}", myNewExpression)  

    End Sub 'Main  
End Class  

샘플 출력:

원래 FailParentOnFailure = False

FailParentOnFailure의 새 값: True

FailParentOnFailure에 대한 식: True

적용 대상