IDTSSequence.Executables 属性

定义

返回与容器关联的 Executable 对象的集合。 此字段为只读。

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

属性值

一个 Executables 集合,该集合包含与此容器关联的 Executable 对象。

示例

Package 继承 IDTSSequence 自集合并实现 ExecutablesExecutables集合。 下面的代码示例将大容量插入任务作为可执行文件添加到包中,然后显示集合的 Executables 创建并循环访问它,并显示该 CreationName任务。

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

namespace Executables_API  
{  
        class Program  
        {  
        static void Main(string[] args)  
        {  
            Package pkg = new Package();  
            Executable exec = pkg.Executables.Add("STOCK:BulkInsertTask");  

            // Obtain the collection.  
            Executables pgkExecs = pkg.Executables;  
            foreach (Executable eachExec in pgkExecs)  
            {  
                TaskHost th = exec as TaskHost;  
                Console.WriteLine("Executable creation name is: {0}", th.CreationName);  
            }  
                        // Show that at least one executable exists.  
            if (pgkExecs.Contains(0))  
            {  
                Console.WriteLine("Contains returned true");  
            }  
            else  
            {  
                Console.WriteLine("Contains returned false");  
            }  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  

Namespace Executables_API  
        Class Program  
        Shared  Sub Main(ByVal args() As String)  
            Dim pkg As Package =  New Package()   
            Dim exec As Executable =  pkg.Executables.Add("STOCK:BulkInsertTask")   

            ' Obtain the collection.  
            Dim pgkExecs As Executables =  pkg.Executables   
            Dim eachExec As Executable  
            For Each eachExec In pgkExecs  
                Dim th As TaskHost =  exec as TaskHost   
                Console.WriteLine("Executable creation name is: {0}", th.CreationName)  
            Next  
                        ' Show that at least one executable exists.  
            If pgkExecs.Contains(0) Then  
                Console.WriteLine("Contains returned true")  
            Else   
                Console.WriteLine("Contains returned false")  
            End If  
        End Sub  
        End Class  
End Namespace  

示例输出:

Executable creation name is: Microsoft.SqlServer.Dts.Tasks.BulkInsertTask.BulkInsertTask, Microsoft.SqlServer.BulkInsertTask, Version=10.0.000.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91

Contains returned true

适用于