Metoda Application.LoadPackage (String, IDTSEvents, Boolean)
Ładunki Package z systemu plików i określa model wątka.
Przestrzeń nazw: Microsoft.SqlServer.Dts.Runtime
Zestaw: Microsoft.SqlServer.ManagedDTS (w Microsoft.SqlServer.ManagedDTS.dll)
Składnia
'Deklaracja
Public Function LoadPackage ( _
fileName As String, _
events As IDTSEvents, _
loadNeutral As Boolean _
) As Package
'Użycie
Dim instance As Application
Dim fileName As String
Dim events As IDTSEvents
Dim loadNeutral As Boolean
Dim returnValue As Package
returnValue = instance.LoadPackage(fileName, _
events, loadNeutral)
public Package LoadPackage(
string fileName,
IDTSEvents events,
bool loadNeutral
)
public:
Package^ LoadPackage(
String^ fileName,
IDTSEvents^ events,
bool loadNeutral
)
member LoadPackage :
fileName:string *
events:IDTSEvents *
loadNeutral:bool -> Package
public function LoadPackage(
fileName : String,
events : IDTSEvents,
loadNeutral : boolean
) : Package
Parametry
- fileName
Typ: System.String
Nazwa pliku, który zawiera pakiet do załadowania.
- events
Typ: Microsoft.SqlServer.Dts.Runtime.IDTSEvents
IDTSEvents interfejs.
- loadNeutral
Typ: System.Boolean
A wartość logiczna , wskazuje, czy należy załadować pakiet jako wątki w położeniu neutralnym.Jeśli false, wczytuje wątkowane komórkowo pakiet.
Wartość zwracana
Typ: Microsoft.SqlServer.Dts.Runtime.Package
Pakiet, który został załadowany.
Przykłady
Następujący przykładowy kod ładuje pakiet z ustawienie systemu plików loadNeutral Flaga false, a następnie zwraca kilka właściwości pakietu.
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
Przykładowe dane wyjściowe:
Number of configurations = 0
VersionGUID = Microsoft.SqlServer.Dts.Runtime.DtsProperty
ProtectionLevel = EncryptSensitiveWithUserKey
Zobacz także