Application.ExistsOnDtsServer(String, String) Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Devuelve un valor booleano que indica si el paquete especificado ya existe en el servicio Integration Services.
public:
bool ExistsOnDtsServer(System::String ^ sPackagePath, System::String ^ sServerName);
public bool ExistsOnDtsServer (string sPackagePath, string sServerName);
member this.ExistsOnDtsServer : string * string -> bool
Public Function ExistsOnDtsServer (sPackagePath As String, sServerName As String) As Boolean
Parámetros
- sPackagePath
- String
La ruta completa del paquete.
- sServerName
- String
El nombre del servidor para buscar el paquete.
Devoluciones
true si el paquete especificado por sPackagePath
existe en el servidor denominado por sServerName
; de lo contrario, false.
Ejemplos
En el ejemplo de código siguiente se muestra un paquete que se guarda en el sistema de archivos en la carpeta primaria, myFolder2
. A continuación, el ejemplo comprueba si el paquete se guardó consultando mediante el ExistsOnDtsServer método .
static void Main(string[] args)
{
// The variable pkg points to the location
// of the ExecuteProcess package sample
// that is 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);
// Save the package under myFolder which is found under the
// File System folder on the DTS Service
app.SaveToDtsServer(p, null, @"File System\myFolder2", "yourserver");
// Verify that the package was saved by
// using ExistsOnDtsServer.
Boolean packageExists = app.ExistsOnDtsServer(@"File System\myFolder", "yourserver");
Console.WriteLine("Package exists? " + packageExists);
}
Sub Main(ByVal args() As String)
' The variable pkg points to the location
' of the ExecuteProcess package sample
' that is 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)
' Save the package under myFolder which is found under the
' File System folder on the DTS Service
app.SaveToDtsServer(p, Nothing, "File System\myFolder2", "yourserver")
' Verify that the package was saved by
' using ExistsOnDtsServer.
Dim packageExists As Boolean = app.ExistsOnDtsServer("File System\myFolder", "yourserver")
Console.WriteLine("Package exists? " + packageExists)
End Sub
Salida del ejemplo:
Folder exists? True
Package exists? True
Folder exists? False