ForEachLoop.VariableMappings Proprietà

Definizione

Restituisce una raccolta ForEachVariableMappings contenente i mapping delle variabili per l'oggetto ForEachLoop.

public:
 property Microsoft::SqlServer::Dts::Runtime::ForEachVariableMappings ^ VariableMappings { Microsoft::SqlServer::Dts::Runtime::ForEachVariableMappings ^ get(); };
public Microsoft.SqlServer.Dts.Runtime.ForEachVariableMappings VariableMappings { get; }
member this.VariableMappings : Microsoft.SqlServer.Dts.Runtime.ForEachVariableMappings
Public ReadOnly Property VariableMappings As ForEachVariableMappings

Valore della proprietà

Raccolta ForEachVariableMappings.

Esempio

Nell'esempio di codice seguente viene creato un ForEachLoopoggetto , vengono impostate alcune proprietà usando l'insieme , viene creato un VariableMappings oggetto e viene aggiunto un VariableMappings oggetto in cui viene eseguito il Properties mapping di una variabile a un valore .

// Create the new package.  
Package package = new Package();  
// Add variables.  
package.Variables.Add("Id", false, "", 0);  

// Create ForEachLoop task  
Executables executables = package.Executables;  
ForEachLoop forEachLoop = executables.Add("STOCK:FOREACHLOOP") as ForEachLoop;  

// Set name and description properties on the ForEachLoop.  
// Show how to set them using the Properties collection.  
forEachLoop.Properties["Name"].SetValue(forEachLoop, "ForEachLoop Container");  
forEachLoop.Properties["Description"].SetValue(forEachLoop, "ForEachLoop Container");  

// Create a VariableMappings and VariableMapping objects.  
ForEachVariableMappings forEachVariableMappings = forEachLoop.VariableMappings;  
ForEachVariableMapping forEachVariableMapping = forEachVariableMappings.Add();  

// Create a mapping between the variable and its value.  
forEachVariableMapping.VariableName = "Id";  
forEachVariableMapping.ValueIndex = 0;  
' Create the new package.  
Dim package As Package =  New Package()   
' Add variables.  
package.Variables.Add("Id", False, "", 0)  

' Create ForEachLoop task  
Dim executables As Executables =  package.Executables   
Dim forEachLoop As ForEachLoop =  executables.Add("STOCK:FOREACHLOOP") as ForEachLoop  

' Set name and description properties on the ForEachLoop.  
' Show how to set them using the Properties collection.  
forEachLoop.Properties("Name").SetValue(forEachLoop, "ForEachLoop Container")  
forEachLoop.Properties("Description").SetValue(forEachLoop, "ForEachLoop Container")  

Create a VariableMappings and VariableMapping objects.  
Dim forEachVariableMappings As ForEachVariableMappings =  forEachLoop.VariableMappings   
Dim forEachVariableMapping As ForEachVariableMapping =  forEachVariableMappings.Add()   

' Create a mapping between the variable and its value.  
forEachVariableMapping.VariableName = "Id"  
forEachVariableMapping.ValueIndex = 0  

Si applica a