Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Application.LoadPackage Method (String, IDTSEvents)

Loads a Package from the file system.

Namespace:  Microsoft.SqlServer.Dts.Runtime
Assembly:  Microsoft.SqlServer.ManagedDTS (in Microsoft.SqlServer.ManagedDTS.dll)
'Declaration
Public Function LoadPackage ( _
	fileName As String, _
	events As IDTSEvents _
) As Package
'Usage
Dim instance As Application
Dim fileName As String
Dim events As IDTSEvents
Dim returnValue As Package

returnValue = instance.LoadPackage(fileName, _
	events)

Parameters

fileName
Type: System.String
The name of the file that contains the package to load.
events
Type: Microsoft.SqlServer.Dts.Runtime.IDTSEvents
An IDTSEvents interface.

Return Value

Type: Microsoft.SqlServer.Dts.Runtime.Package
The package that was loaded.

The following code example loads a package from the file system, and then returns several properties for the package.

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

Sample Output:

Number of configurations = 0

VersionGUID = Microsoft.SqlServer.Dts.Runtime.DtsProperty

ProtectionLevel = EncryptSensitiveWithUserKey

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.