Application.ExistsOnDtsServer(String, String) Méthode

Définition

Retourne une valeur booléenne qui indique si le package spécifié existe déjà sur le service 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

Paramètres

sPackagePath
String

Chemin d'accès complet du package.

sServerName
String

Nom du serveur sur lequel rechercher le package.

Retours

true si le package spécifié par sPackagePath existe sur le serveur nommé par sServerName; sinon, false.

Exemples

L’exemple de code suivant montre un package enregistré dans le système de fichiers sous le dossier parent. myFolder2 L’exemple vérifie ensuite si le package a été enregistré en interrogeant à l’aide de la ExistsOnDtsServer méthode.

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  

Exemple de sortie :

Folder exists? True

Package exists? True

Folder exists? False

S’applique à