次の方法で共有


Package.GetExpression メソッド

指定したプロパティの式を表す値を返します。 Null は、式が割り当てられていないことを示します。

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

構文

'宣言
Public Function GetExpression ( _
    propertyName As String _
) As String
'使用
Dim instance As Package 
Dim propertyName As String 
Dim returnValue As String 

returnValue = instance.GetExpression(propertyName)
public string GetExpression(
    string propertyName
)
public:
virtual String^ GetExpression(
    String^ propertyName
) sealed
abstract GetExpression : 
        propertyName:string -> string  
override GetExpression : 
        propertyName:string -> string
public final function GetExpression(
    propertyName : String
) : String

パラメーター

  • propertyName
    型: System.String
    参照する式のプロパティの名前です。

戻り値

型: System.String
プロパティの評価に使用される式を表す値です。

実装

IDTSPropertiesProvider.GetExpression(String)

説明

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

使用例

次のコード例では、GetExpression を使用して DelayValidation プロパティの値を変更し、次に SetExpression を使用して新しい値を表示します。

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;

namespace Microsoft.SqlServer.SSIS.Samples
{
    class Program
    {
        static void Main(string[] args)
        {
            Package pkg = new Package();
            // Set an expression on one of the properties.
            DtsProperties pkgProperties = pkg.Properties;

            // View information about the DelayValidation property 
            // before setting it with the SetExpression method.
            Object myValue = pkgProperties["DelayValidation"].GetValue(pkg);
            String mySValue = myValue.ToString();
            Console.WriteLine("value before is {0}", mySValue); 
            
            // Use SetExpression to set the value to true.
            String myTrueString = "true";
            pkgProperties["DelayValidation"].SetExpression(pkg, myTrueString);

            // Validate the package to set the expression onto the property.
            DTSExecResult valResult = pkg.Validate(null, null, null, null);

            // Verify the new setting.
            myValue = pkgProperties["DelayValidation"].GetValue(pkg);
            mySValue = myValue.ToString();

            String myExpression = pkg.Properties["DelayValidation"].GetExpression(pkg);
            String mySExpression = myExpression.ToString();
            Console.WriteLine("The value and expression is {0}, {1}", mySValue, mySExpression);
        }
    }
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime

Class Program
    Shared Sub Main(ByVal args() As String) 
        Dim pkg As New Package()
        ' Set an expression on one of the properties.
        Dim pkgProperties As DtsProperties = pkg.Properties
        
        ' View information about the DelayValidation property 
        ' before setting it with the SetExpression method.
        Dim myValue As [Object] = pkgProperties("DelayValidation").GetValue(pkg)
        Dim mySValue As String = myValue.ToString()
        Console.WriteLine("value before is {0}", mySValue)
        
        ' Use SetExpression to set the value to true.
        Dim myTrueString As String = "true"
        pkgProperties("DelayValidation").SetExpression(pkg, myTrueString)
        
        ' Validate the package to set the expression onto the property.
        Dim valResult As DTSExecResult = pkg.Validate(Nothing, Nothing, Nothing, Nothing)
        
        ' Verify the new setting.
        myValue = pkgProperties("DelayValidation").GetValue(pkg)
        mySValue = myValue.ToString()
        
        Dim myExpression As String = pkg.Properties("DelayValidation").GetExpression(pkg)
        Dim mySExpression As String = myExpression.ToString()
        Console.WriteLine("The value and expression is {0}, {1}", mySValue, mySExpression)
    End Sub
End Class

サンプルの出力:

value before is False

The value and expression is True, true

関連項目

参照

Package クラス

Microsoft.SqlServer.Dts.Runtime 名前空間