Application.LoadPackage Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Memuat paket.
Overload
LoadPackage(String, IDTSEvents) |
Package Memuat dari sistem file. |
LoadPackage(String, IDTSEvents, Boolean) |
Package Memuat dari sistem file, dan menentukan model utas. |
LoadPackage(String, IDTSEvents)
Package Memuat dari sistem file.
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
Parameter
- fileName
- String
Nama file yang berisi paket yang akan dimuat.
- events
- IDTSEvents
Antarmuka IDTSEvents .
Mengembalikan
Paket yang dimuat.
Contoh
Contoh kode berikut memuat paket dari sistem file, lalu mengembalikan beberapa properti untuk paket tersebut.
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
Contoh Output:
Number of configurations = 0
VersionGUID = Microsoft.SqlServer.Dts.Runtime.DtsProperty
ProtectionLevel = EncryptSensitiveWithUserKey
Berlaku untuk
LoadPackage(String, IDTSEvents, Boolean)
Package Memuat dari sistem file, dan menentukan model utas.
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
Parameter
- fileName
- String
Nama file yang berisi paket yang akan dimuat.
- events
- IDTSEvents
Antarmuka IDTSEvents .
- loadNeutral
- Boolean
Boolean yang menunjukkan apakah akan memuat paket sebagai utas netral. Jika false, memuat paket sebagai rangkaian apartemen.
Mengembalikan
Paket yang dimuat.
Contoh
Contoh kode berikut memuat paket dari sistem file, mengatur loadNeutral
bendera ke false
, lalu mengembalikan beberapa properti untuk paket.
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
Contoh Output:
Number of configurations = 0
VersionGUID = Microsoft.SqlServer.Dts.Runtime.DtsProperty
ProtectionLevel = EncryptSensitiveWithUserKey