Sequence.SetExpression(String, String) Methode

Definition

Weist der Eigenschaft den angegebenen Ausdruck zu. Geben Sie null an, um einen vorhandenen Ausdruck aus der Eigenschaft zu entfernen.

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)

Parameter

propertyName
String

Der Name der Eigenschaft, der der Ausdruck zugewiesen werden soll.

expression
String

Der Ausdruck.

Implementiert

Beispiele

Im folgenden Codebeispiel wird SetExpression der Wert des Description Containers Sequence geändert. GetExpression Anschließend wird der Ausdruck abgerufen.

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

Beispielausgabe:

Ursprünglicher Wert der Beschreibung:

Neuer Wert der Beschreibung: Testsequenz

Ausdruck für Beschreibung: "Testsequenz"

Hinweise

Dies propertyName kann eine beliebige Eigenschaft sein, die für das Objekt verfügbar ist.

Gilt für: