Share via


Executable 생성자

정의

Executable 클래스의 새 인스턴스를 초기화합니다.

protected:
 Executable();
protected Executable ();
Protected Sub New ()

예제

Package 클래스는 여러 수준의 상속을 통해 Executables 클래스의 자식입니다. 다음 코드 예제에서는 패키지와 함께 클래스를 Executable 사용하여 패키지 컬렉션에 대량 삽입 작업 실행 파일을 Executables 추가하는 방법을 보여 있습니다.

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

namespace Executables_API  
{  
        class Program  
        {  
                static void Main(string[] args)  
                {  
                    // Create the package and add the BulkInsertTask.  
                    Package pkg = new Package();  
                    Executable exec = pkg.Executables.Add("STOCK:BulkInsertTask");  
                    TaskHost myTask = exec as TaskHost;  
                    BulkInsertTask myBI = myTask.InnerObject as BulkInsertTask;  
                    myBI.DebugMode = false;  
                    myBI.CheckConstraints = false;  
                    myBI.KeepIdentity = true;  

                    // Obtain the collection.  
                    Executables pgkExecs = pkg.Executables;  
                    // Show the number of executables in the collection.  
                    Console.WriteLine("The first package contains {0} executables", pgkExecs.Count);  
                }  
        }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  
Imports Microsoft.SqlServer.Dts.Tasks.BulkInsertTask  

Namespace Executables_API  
        Class Program  
                Shared  Sub Main(ByVal args() As String)  
                    ' Create the package and add the BulkInsertTask.  
                    Dim pkg As Package =  New Package()   
                    Dim exec As Executable =  pkg.Executables.Add("STOCK:BulkInsertTask")   
                    Dim myTask As TaskHost =  exec as TaskHost   
                    Dim myBI As BulkInsertTask =  myTask.InnerObject as BulkInsertTask   
                    myBI.DebugMode = False  
                    myBI.CheckConstraints = False  
                    myBI.KeepIdentity = True  

                    ' Obtain the collection.  
                    Dim pgkExecs As Executables =  pkg.Executables   
                    ' Show the number of executables in the collection.  
                    Console.WriteLine("The first package contains {0} executables", pgkExecs.Count)  
                End Sub  
        End Class  
End Namespace  

샘플 출력:

The first package contains 1 executables

적용 대상