Freigeben über


Application.ExistsOnDtsServer(String, String) Methode

Definition

Gibt einen booleschen Wert zurück, der angibt, ob das angegebene Paket bereits im Integration Services-Dienst vorhanden ist.

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

Parameter

sPackagePath
String

Der vollqualifizierte Pfad des Pakets.

sServerName
String

Der Name des Servers, der nach dem Paket durchsucht werden soll.

Gibt zurück

true, wenn das von sPackagePath dem Server angegebene Paket mit sServerNamedem Namen ; andernfalls "false" vorhanden ist.

Beispiele

Das folgende Codebeispiel zeigt ein Paket, das im Dateisystem unter dem übergeordneten Ordner gespeichert wird. myFolder2 Im Beispiel wird überprüft, ob das Paket mithilfe der ExistsOnDtsServer Methode gespeichert wurde.

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  

Beispielausgabe:

Folder exists? True

Package exists? True

Folder exists? False

Gilt für: