Compartir a través de


DtsEventHandler.GetExpression Method

Returns the expression for the specified property. Null means no expression is assigned.

Espacio de nombres: Microsoft.SqlServer.Dts.Runtime
Ensamblado: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

Sintaxis

'Declaración
Public Function GetExpression ( _
    propertyName As String _
) As String
public string GetExpression (
    string propertyName
)
public:
virtual String^ GetExpression (
    String^ propertyName
) sealed
public final String GetExpression (
    String propertyName
)
public final function GetExpression (
    propertyName : String
) : String

Parámetros

  • propertyName
    The name of the property whose expression you want to see.

Valor devuelto

A String that contains the expression used to evaluate the property.

Ejemplo

The following code example creates a package and adds a DtsEventHandler for the package OnError event. Using the SetExpression, the FailParentOnFailure property is modified. Using the GetExpression method, the new value and associated expression are displayed.

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

Sample Output:

Original FailParentOnFailure = False

New value of FailParentOnFailure: True

Expression for FailParentOnFailure: True

Seguridad para subprocesos

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Plataformas

Plataformas de desarrollo

Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.

Plataformas de destino

Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.

Vea también

Referencia

DtsEventHandler Class
DtsEventHandler Members
Microsoft.SqlServer.Dts.Runtime Namespace