Compartir a través de


RunningPackage.Stop Method

Stops the selected package.

Espacio de nombres: Microsoft.SqlServer.Dts.Runtime
Ensamblado: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

Sintaxis

'Declaración
Public Sub Stop
public void Stop ()
public:
void Stop ()
public void Stop ()
public function Stop ()

Notas

The Stop method issues a stop request to the Integration Services service, but this does not stop packages immediately. There may be a delay between the time a stop request is issued and the time that packages actually stop.

Ejemplo

The following example shows properties of the packages that are currently running. The example then stops all the running packages.

static void Main(string[] args)
        {
            Application app = new Application();
            RunningPackages pkgs = app.GetRunningPackages("yourserver");

            int pkgsRunning = pkgs.Count;
            Console.WriteLine("Packages before stop: thas + pkgsRunning);

            foreach (RunningPackage p in pkgs)
            {
                Console.WriteLine("InstanceID: " + p.InstanceID);
                Console.WriteLine("PackageDescription: " + p.PackageDescription);
                Console.WriteLine("PackageID: " + p.PackageID);
                Console.WriteLine("PackageName: " + p.PackageName);
                Console.WriteLine("UserName: " + p.UserName);
            }

            pkgs = app.GetRunningPackages("yourserver");
            foreach (RunningPackage package in pkgs)
            {
                package.Stop();
            }

            pkgsRunning = app.GetRunningPackages("yourserver").Count;
            Console.WriteLine("Packages after stop " + pkgsRunning);
        }
Shared  Sub Main(ByVal args() As String)
            Dim app As Application =  New Application() 
            Dim pkgs As RunningPackages =  app.GetRunningPackages("yourserver") 
 
            Dim pkgsRunning As Integer =  pkgs.Count 
            Console.WriteLine("Packages before stop: " + pkgsRunning)
 
            Dim p As RunningPackage
            For Each p In pkgs
                Console.WriteLine("InstanceID: " + p.InstanceID)
                Console.WriteLine("PackageDescription: " + p.PackageDescription)
                Console.WriteLine("PackageID: " + p.PackageID)
                Console.WriteLine("PackageName: " + p.PackageName)
                Console.WriteLine("UserName: " + p.UserName)
            Next
 
            pkgs = app.GetRunningPackages("yourserver")
            Dim package As RunningPackage
            For Each package In pkgs
                package.Stop()
            Next
 
            pkgsRunning = app.GetRunningPackages("yourserver").Count
            Console.WriteLine("Packages after stop " + pkgsRunning)
End Sub

Sample Output:

Packages before stop: 1

InstanceID: 141f9f2e-920a-4c47-a948-2c0b52a156bd

PackageDescription:

PackageID: aad06953-9847-4ed4-a3b5-fa6092c56e20

PackageName: DTSPackage1

UserName: YOURSERVER\USERID

Packages after stop 0

Seguridad para subprocesos

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Plataformas

Plataformas de desarrollo

Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.

Plataformas de destino

Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.

Vea también

Referencia

RunningPackage Class
RunningPackage Members
Microsoft.SqlServer.Dts.Runtime Namespace