次の方法で共有


Sequence.SetExpression Method

指定した式をプロパティに割り当てます。既存の式をプロパティから削除するには、null を指定します。

名前空間: Microsoft.SqlServer.Dts.Runtime
アセンブリ: Microsoft.SqlServer.ManagedDTS (microsoft.sqlserver.manageddts.dll 内)

構文

'宣言
Public Sub SetExpression ( _
    propertyName As String, _
    expression As String _
)
public void SetExpression (
    string propertyName,
    string expression
)
public:
virtual void SetExpression (
    String^ propertyName, 
    String^ expression
) sealed
public final void SetExpression (
    String propertyName, 
    String expression
)
public final function SetExpression (
    propertyName : String, 
    expression : String
)

パラメータ

  • propertyName
    式を割り当てるプロパティの名前です。
  • expression
    式です。

解説

propertyName には、オブジェクトで使用可能な任意のプロパティを指定できます。

使用例

次のコード例では、SetExpression を使用して、Sequence コンテナの Description の値を変更します。次に 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);
        }
    }
}

サンプルの出力 :

Original value of Description:

New value of Description: Testing Sequence

Expression for Description: "Testing Sequence"

スレッド セーフ

この型の public static (Microsoft Visual Basic では共有 ) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

プラットフォーム

開発プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

対象プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

参照

関連項目

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