Freigeben über


ForEachLoop.VariableMappings Property

Returns a ForEachVariableMappings collection that contains the variable mappings for the ForEachLoop.

Namespace: Microsoft.SqlServer.Dts.Runtime
Assembly : Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

Syntax

'Declaration
Public ReadOnly Property VariableMappings As ForEachVariableMappings
public ForEachVariableMappings VariableMappings { get; }
public:
property ForEachVariableMappings^ VariableMappings {
    ForEachVariableMappings^ get ();
}
/** @property */
public ForEachVariableMappings get_VariableMappings ()
public function get VariableMappings () : ForEachVariableMappings

Eigenschaftswert

A ForEachVariableMappings collection.

Beispiel

The following code example creates a ForEachLoop, sets some properties using the Properties collection, creates a VariableMappings object, and adds a VariableMappings where a variable is mapped to a value.

// 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

Threadsicherheit

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Plattformen

Entwicklungsplattformen

Eine Liste der unterstützten Plattformen finden Sie unterHardware- und Softwareanforderungen für die Installation von SQL Server 2005.

Zielplattforme

Eine Liste der unterstützten Plattformen finden Sie unterHardware- und Softwareanforderungen für die Installation von SQL Server 2005.

Siehe auch

Verweis

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