Sequence.GetExpression(String) Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Restituisce una stringa che contiene l'espressione per la proprietà specificata. Nullo significa che nessuna espressione viene assegnata.
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
Parametri
- propertyName
- String
Il nome della proprietà la cui espressione vuoi vedere.
Valori restituiti
Una stringa che contiene l'espressione usata per valutare la proprietà.
Implementazioni
Esempio
Il seguente esempio di codice viene utilizzato SetExpression per modificare il valore di su Description un Sequence contenitore. Poi GetExpression viene usato per recuperare l'espressione.
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);
}
}
}
Output di esempio:
Valore originale della descrizione:
Nuovo valore della Descrizione: Sequenza di Test
Espressione per descrizione: "Sequenza di test"
Commenti
Può propertyName essere qualsiasi proprietà disponibile sull'oggetto.