Application.GetRunningPackages(String) Méthode

Définition

Retourne une collection RunningPackages qui contient des objets RunningPackage. Cette propriété est en lecture seule.

public:
 Microsoft::SqlServer::Dts::Runtime::RunningPackages ^ GetRunningPackages(System::String ^ server);
public Microsoft.SqlServer.Dts.Runtime.RunningPackages GetRunningPackages (string server);
member this.GetRunningPackages : string -> Microsoft.SqlServer.Dts.Runtime.RunningPackages
Public Function GetRunningPackages (server As String) As RunningPackages

Paramètres

server
String

Instance de SQL Server sur laquelle l’application s’exécute.

Retours

Collection RunningPackages qui contient les objets RunningPackage représentant tous les packages en cours d'exécution sur l'ordinateur.

Exemples

L’exemple de code suivant montre comment récupérer la collection de packages en cours d’exécution à partir de l’objet application, puis itérer sur chaque package, afficher le InstanceID, PackageID, , PackageDescription, PackageNameet UserName.

//...  
//   Declare and instantiate objects here.  
Application app = new Application();  
//...  
// Create a RunningPackages collection, named pkgs, and fill it  
// with the running packages from the application object.  
RunningPackages pkgs = app.GetRunningPackages(null);  

// Enumerate over each package in the collection and display some data.  
foreach(RunningPackage package in pkgs)  
    {  
        Console.WriteLine("InstanceID: "+package.InstanceID);  
        Console.WriteLine("PackageDescription: "+package.PackageDescription);  
        Console.WriteLine("PackageID: "+package.PackageID);  
        Console.WriteLine("PackageName: "+package.PackageName);  
        Console.WriteLine("UserName: "+package.UserName);  
    }  
//   Insert more code here.  
'...  
'   Declare and instantiate objects here.  
Dim app As New Application  
'...  
' Create a RunningPackages collection, named pkgs, and fill it  
' with the running packages from the application object.  
Dim pkgs As RunningPackages = app.GetRunningPackages(Nothing)   

' Enumerate over each package in the collection and display some data.  
For Each package As RunningPackage In pkgs  
        Console.WriteLine("InstanceID: " & package.InstanceID.ToString())  
        Console.WriteLine("PackageDescription: " & package.PackageDescription)  
        Console.WriteLine("PackageID: " & package.PackageID.ToString())  
        Console.WriteLine("PackageName: " & package.PackageName)  
        Console.WriteLine("UserName: " & package.UserName)  
Next  
'   Insert more code here.  

Remarques

Les administrateurs voient tous les packages qui s’exécutent actuellement sur l’ordinateur ; d’autres utilisateurs voient uniquement ces packages qu’ils ont démarrés.

S’applique à