DtsEventHandler.GetExpression(String) Método

Definición

Devuelve la expresión para la propiedad especificada. Null significa que no se asigna ninguna expresión.

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

Parámetros

propertyName
String

El nombre de la propiedad cuya expresión desea ver.

Devoluciones

Cadena que contiene la expresión usada para evaluar la propiedad .

Implementaciones

Ejemplos

En el ejemplo de código siguiente se crea un paquete y se agrega un DtsEventHandler para el evento de paquete OnError . Con , SetExpressionse modifica la FailParentOnFailure propiedad . Con el GetExpression método , se muestran el nuevo valor y la expresión asociada.

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  

Salida del ejemplo:

Original FailParentOnFailure = False

Nuevo valor de FailParentOnFailure: True

Expresión para FailParentOnFailure: True

Se aplica a