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

要查看其表达式的属性的名称。

返回

包含用于计算属性的表达式的字符串。

实现

示例

下面的代码示例用于SetExpression修改容器上的SequenceDescription。 然后 GetExpression 用于检索表达式。

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

示例输出:

说明的原始值:

说明的新值:测试序列

描述的表达式:“测试序列”

注解

可以是 propertyName 对象上可用的任何属性。

适用于