Aracılığıyla paylaş


TaskHost.SetExpression Yöntemi

Belirtilen ifade atar özellik.Belirtmek nullnull başvuru (Visual Basic'te Nothing) varolan bir ifade özellik kaldırmak için.

Ad Alanı:  Microsoft.SqlServer.Dts.Runtime
Derleme:  Microsoft.SqlServer.ManagedDTS (Microsoft.SqlServer.ManagedDTS içinde.dll)

Sözdizimi

'Bildirim
Public Sub SetExpression ( _
    propertyName As String, _
    expression As String _
)
'Kullanım
Dim instance As TaskHost
Dim propertyName As String
Dim expression As String

instance.SetExpression(propertyName, _
    expression)
public void SetExpression(
    string propertyName,
    string expression
)
public:
virtual void SetExpression(
    String^ propertyName, 
    String^ expression
) sealed
abstract SetExpression : 
        propertyName:string * 
        expression:string -> unit 
override SetExpression : 
        propertyName:string * 
        expression:string -> unit 
public final function SetExpression(
    propertyName : String, 
    expression : String
)

Parametreler

  • propertyName
    Tür: System.String
    ifade atamak için özellik adı.

Uygulamalar

IDTSPropertiesProvider.SetExpression(String, String)

Açıklamalar

propertyName Olabilir özellik hepsine nesnesi.

Örnekler

Aşağıdaki kod örneği nasıl kullanılacağını gösterir SetExpression ve GetExpression yöntemleri TaskHost.Bu kod örneği için barındırılan bir görevdir BulkInsertTask.

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


namespace Microsoft.SqlServer.SSIS.Sample
{
    class Program
        {
        static void Main(string[] args)
        {
            Package pkg = new Package();
            TaskHost th = (TaskHost)pkg.Executables.Add("STOCK:BulkInsertTask");

            // View information about the CheckConstraints property
            // before setting it using the SetExpression method.
            Boolean checkConstraint = (Boolean)th.Properties["CheckConstraints"].GetValue(th);
            Console.WriteLine("Original value of CheckConstraints: {0}", checkConstraint);

            // Use SetExpression to set the value to true.
            String myTrueString = "true";
            th.Properties["CheckConstraints"].SetExpression(th, myTrueString);

            // 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.
            checkConstraint = (Boolean)th.Properties["CheckConstraints"].GetValue(th);
            String myExpression = th.Properties["CheckConstraints"].GetExpression(th);
            Console.WriteLine("New value of CheckConstraints: {0}", checkConstraint);
            Console.WriteLine("Expression for CheckConstraints: {0}", myExpression);
        }
    }
}

Örnek Çıktı:

CHECKCONSTRAINTS özgün değeri: False

CHECKCONSTRAINTS yeni değeri: True

Deyim CHECKCONSTRAINTS için: TRUE