Sequence.GetExpression Method
Returns a String that contains the expression for the specified property. Null means no expression is assigned.
命名空间: Microsoft.SqlServer.Dts.Runtime
程序集: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)
语法
声明
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
参数
- propertyName
The name of the property whose expression you want to see.
返回值
A String that contains the expression used to evaluate the property.
备注
The propertyName can be any property available on the object.
示例
The following code example uses SetExpression to modify the value of the Description on a Sequence container. Then GetExpression is used to retrieve the expression.
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);
}
}
}
Sample Output:
Original value of Description:
New value of Description: Testing Sequence
Expression for Description: "Testing Sequence"
线程安全
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.
平台
开发平台
有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。
目标平台
有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。
请参阅
参考
Sequence Class
Sequence Members
Microsoft.SqlServer.Dts.Runtime Namespace