Application.ExistsOnDtsServer(String, String) Metodo

Definizione

Restituisce un booleano che indica se il pacchetto specificato esiste già sul servizio 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

Parametri

sPackagePath
String

Il percorso completamente qualificato del pacchetto.

sServerName
String

Il nome del server per cercare il pacchetto.

Valori restituiti

true se il pacchetto specificato da sPackagePath esiste sul server denominato da sServerName; altrimenti, falso.

Esempio

Il seguente esempio di codice mostra un pacchetto salvato nel File System sotto la cartella genitore, myFolder2. L'esempio verifica quindi se il pacchetto è stato salvato tramite query usando il ExistsOnDtsServer metodo.

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  

Output di esempio:

Folder exists? True

Package exists? True

Folder exists? False

Si applica a