Compartir a través de


Executable Constructor

Initializes a new instance of the Executable class.

Espacio de nombres: Microsoft.SqlServer.Dts.Runtime
Ensamblado: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

Sintaxis

'Declaración
Protected Sub New
protected Executable ()
protected:
Executable ()
protected Executable ()
protected function Executable ()

Notas

The default constructor initializes any fields to their default values.

Ejemplo

The Package class is a child of the Executables class through several levels of inheritance. The following code example shows how to use the Executable class with a package to add a Bulk Insert task executable to the Executables collection of the package.

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

Sample Output:

The first package contains 1 executables

Plataformas

Plataformas de desarrollo

Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.

Plataformas de destino

Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.

Vea también

Referencia

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