次の方法で共有


ForEachVariableMapping.ValueIndex Property

値としてコレクションを提供する列挙子の配列へのインデックスを取得します。値の設定も可能です。

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

構文

'宣言
Public Property ValueIndex As Object
public Object ValueIndex { get; set; }
public:
property Object^ ValueIndex {
    Object^ get ();
    void set (Object^ value);
}
/** @property */
public Object get_ValueIndex ()

/** @property */
public void set_ValueIndex (Object value)
public function get ValueIndex () : Object

public function set ValueIndex (value : Object)

プロパティ値

配列へのインデックスであるオブジェクトです。

使用例

次のコード例では、ForEachVariableMapping の作成、読み取り/書き込みプロパティの設定、読み取り専用プロパティの表示、および VariableName プロパティと ValueIndex プロパティを使用したマッピングの設定を行います。

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

namespace Microsoft.SqlServer.SSIS.Samples
{
    class Program
    {
        public static void Main()
        {
            // Create the new application and package.
            Application app = new Application();
            Package package = new Package();

            // Create ForEachLoop task
            Executables executables = package.Executables;
            ForEachLoop forEachLoop = executables.Add("STOCK:FOREACHLOOP") as ForEachLoop;
  
            // Create a VariableMappings and VariableMapping objects.
            ForEachVariableMappings forEachVariableMappings = forEachLoop.VariableMappings;
            ForEachVariableMapping forEachVariableMapping = forEachVariableMappings.Add();
            // Set the properties.
            forEachVariableMapping.Description = "My ForEach Variable Mapping";
            forEachVariableMapping.Name = "My Name is ForEachVariableMapping";
            
            // View the read-only properties. CreationName can be blank.
            Console.WriteLine("ID:           {0}", forEachVariableMapping.ID);
            Console.WriteLine("CreationName: {0}", forEachVariableMapping.CreationName);

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

            // Add other tasks to ForEachLoop container.
            //...

            // Run the package when the rest of the code is finished. 
            DTSExecResult status = package.Execute();
        }
    }
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Runtime.Enumerators
Imports Microsoft.SqlServer.Dts.Runtime.Enumerators.Item

Namespace Microsoft.SqlServer.SSIS.Samples
   
   Class Program
      
      Public Shared Sub Main()
         ' Create the new application and package.
         Dim app As New Application()
         Dim package As New Package()
         
         ' Create ForEachLoop task
         Dim executables As Executables = package.Executables
         Dim forEachLoop As ForEachLoop = CType(executables.Add("STOCK:FOREACHLOOP"), ForEachLoop)
         
         ' Create a VariableMappings and VariableMapping objects.
         Dim forEachVariableMappings As ForEachVariableMappings = forEachLoop.VariableMappings
         Dim forEachVariableMapping As ForEachVariableMapping = forEachVariableMappings.Add()
         ' Set the properties.
         forEachVariableMapping.Description = "My ForEach Variable Mapping"
         forEachVariableMapping.Name = "My Name is ForEachVariableMapping"
         
         ' View the read-only properties. CreationName can be blank.
         Console.WriteLine("ID:           {0}", forEachVariableMapping.ID)
         Console.WriteLine("CreationName: {0}", forEachVariableMapping.CreationName)
         
         ' Create a mapping between the variable and its value.
         forEachVariableMapping.VariableName = "Id"
         forEachVariableMapping.ValueIndex = 0
         
         Console.WriteLine()
         
         ' Add other tasks to ForEachLoop container.
         '...
         ' Run the package when the rest of the code is finished. 
         Dim status As DTSExecResult = package.Execute()
      End Sub 'Main
   End Class 'Program
End Namespace 'Microsoft.SqlServer.SSIS.Samples

サンプルの出力 :

ID: {DDCF34B7-853F-4013-B924-93D1A00DEC3F}

CreationName:

スレッド セーフ

この型の public static (Microsoft Visual Basic では共有 ) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

プラットフォーム

開発プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

対象プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

参照

関連項目

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