Compartir a través de


Application.LoadPackage Método

Definición

Carga un paquete.

Sobrecargas

LoadPackage(String, IDTSEvents)

Carga Package del sistema de archivos.

LoadPackage(String, IDTSEvents, Boolean)

Carga Package del sistema de archivos y especifica el modelo de subprocesamiento.

LoadPackage(String, IDTSEvents)

Carga Package del sistema de archivos.

public:
 Microsoft::SqlServer::Dts::Runtime::Package ^ LoadPackage(System::String ^ fileName, Microsoft::SqlServer::Dts::Runtime::IDTSEvents ^ events);
public Microsoft.SqlServer.Dts.Runtime.Package LoadPackage (string fileName, Microsoft.SqlServer.Dts.Runtime.IDTSEvents events);
member this.LoadPackage : string * Microsoft.SqlServer.Dts.Runtime.IDTSEvents -> Microsoft.SqlServer.Dts.Runtime.Package
Public Function LoadPackage (fileName As String, events As IDTSEvents) As Package

Parámetros

fileName
String

Nombre del archivo que contiene el paquete que se va a cargar.

events
IDTSEvents

Interfaz IDTSEvents.

Devoluciones

El paquete que se ha cargado.

Ejemplos

En el ejemplo de código siguiente se carga un paquete desde el sistema de archivos y, a continuación, se devuelven varias propiedades para el paquete.

class ApplicationTests  
    {  
        static void Main(string[] args)  
        {  
            // The variable pkg points to the location of the  
            // ExecuteProcess package sample installed with  
            // the SSIS samples.  
            string pkg = @"C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";  

            Application app = new Application();  
            Package p = app.LoadPackage(pkg, null);  
           // Now that the package is loaded, we can query on  
           // its properties.  
            int n = p.Configurations.Count;  
            DtsProperty  p2 = p.Properties["VersionGUID"];  
            DTSProtectionLevel pl = p.ProtectionLevel;  

            Console.WriteLine("Number of configurations = " + n);  
            Console.WriteLine("VersionGUID = " + p2);  
            Console.WriteLine("ProtectionLevel = " + pl);  
        }  
    }  
Class ApplicationTests  
        Shared  Sub Main(ByVal args() As String)  
            ' The variable pkg points to the location of the  
            ' ExecuteProcess package sample installed with  
            ' the SSIS samples.  
            Dim pkg As String =  "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx"   

            Dim app As Application =  New Application()   
            Dim p As Package =  app.LoadPackage(pkg,Nothing)   
           ' Now that the package is loaded, we can query on  
           ' its properties.  
            Dim n As Integer =  p.Configurations.Count   
            Dim p2 As DtsProperty =  p.Properties("VersionGUID")   
            Dim pl As DTSProtectionLevel =  p.ProtectionLevel   

            Console.WriteLine("Number of configurations = " + n)  
            Console.WriteLine("VersionGUID = " + p2)  
            Console.WriteLine("ProtectionLevel = " + pl)  
        End Sub  
End Class  

Salida del ejemplo:

Number of configurations = 0

VersionGUID = Microsoft.SqlServer.Dts.Runtime.DtsProperty

ProtectionLevel = EncryptSensitiveWithUserKey

Se aplica a

LoadPackage(String, IDTSEvents, Boolean)

Carga Package del sistema de archivos y especifica el modelo de subprocesamiento.

public:
 Microsoft::SqlServer::Dts::Runtime::Package ^ LoadPackage(System::String ^ fileName, Microsoft::SqlServer::Dts::Runtime::IDTSEvents ^ events, bool loadNeutral);
public Microsoft.SqlServer.Dts.Runtime.Package LoadPackage (string fileName, Microsoft.SqlServer.Dts.Runtime.IDTSEvents events, bool loadNeutral);
member this.LoadPackage : string * Microsoft.SqlServer.Dts.Runtime.IDTSEvents * bool -> Microsoft.SqlServer.Dts.Runtime.Package
Public Function LoadPackage (fileName As String, events As IDTSEvents, loadNeutral As Boolean) As Package

Parámetros

fileName
String

Nombre del archivo que contiene el paquete que se va a cargar.

events
IDTSEvents

Interfaz IDTSEvents.

loadNeutral
Boolean

Valor booleano que indica si se va a cargar el paquete como subproceso neutro. Si es false, carga el paquete como un subproceso de apartamento.

Devoluciones

El paquete que se ha cargado.

Ejemplos

En el ejemplo de código siguiente se carga un paquete desde el sistema de archivos, se establece la loadNeutral marca falseen y, a continuación, se devuelven varias propiedades para el paquete.

class ApplicationTests  
    {  
        static void Main(string[] args)  
        {  
            // The variable pkg points to the location of the  
            // ExecuteProcess package sample installed with  
            // the SSIS samples.  
            string pkg = @"C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";  

            Application app = new Application();  
            Package p = app.LoadPackage(pkg, null, false);  
           // Now that the package is loaded, we can query on  
           // its properties.  
            int n = p.Configurations.Count;  
            DtsProperty  p2 = p.Properties["VersionGUID"];  
            DTSProtectionLevel pl = p.ProtectionLevel;  

            Console.WriteLine("Number of configurations = " + n);  
            Console.WriteLine("VersionGUID = " + p2);  
            Console.WriteLine("ProtectionLevel = " + pl);  
        }  
    }  
Class ApplicationTests  
        Shared  Sub Main(ByVal args() As String)  
            ' The variable pkg points to the location of the  
            ' ExecuteProcess package sample installed with  
            ' the SSIS samples.  
            Dim pkg As String =  "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx"   

            Dim app As Application =  New Application()   
            Dim p As Package =  app.LoadPackage(pkg,Nothing,False)   
           ' Now that the package is loaded, we can query on  
           ' its properties.  
            Dim n As Integer =  p.Configurations.Count   
            Dim p2 As DtsProperty =  p.Properties("VersionGUID")   
            Dim pl As DTSProtectionLevel =  p.ProtectionLevel   

            Console.WriteLine("Number of configurations = " + n)  
            Console.WriteLine("VersionGUID = " + p2)  
            Console.WriteLine("ProtectionLevel = " + pl)  
        End Sub  
End Class  

Salida del ejemplo:

Number of configurations = 0

VersionGUID = Microsoft.SqlServer.Dts.Runtime.DtsProperty

ProtectionLevel = EncryptSensitiveWithUserKey

Se aplica a