Share via


LoadPackage メソッド (String, IDTSEvents)

ファイル システムから Package を読み込みます。

名前空間:  Microsoft.SqlServer.Dts.Runtime
アセンブリ:  Microsoft.SqlServer.ManagedDTS (Microsoft.SqlServer.ManagedDTS.dll)

構文

'宣言
Public Function LoadPackage ( _
    fileName As String, _
    events As IDTSEvents _
) As Package
'使用
Dim instance As Application
Dim fileName As String
Dim events As IDTSEvents
Dim returnValue As Package

returnValue = instance.LoadPackage(fileName, _
    events)
public Package LoadPackage(
    string fileName,
    IDTSEvents events
)
public:
Package^ LoadPackage(
    String^ fileName, 
    IDTSEvents^ events
)
member LoadPackage : 
        fileName:string * 
        events:IDTSEvents -> Package 
public function LoadPackage(
    fileName : String, 
    events : IDTSEvents
) : Package

パラメーター

戻り値

型: Microsoft.SqlServer.Dts.Runtime. . :: . .Package
読み込まれたパッケージです。

使用例

次のコード例では、ファイル システムからパッケージを読み込み、そのパッケージの複数のプロパティを返します。

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

サンプルの出力 :

Number of configurations = 0

VersionGUID = Microsoft.SqlServer.Dts.Runtime.DtsProperty

ProtectionLevel = EncryptSensitiveWithUserKey