Partager via


FolderExistsOnDtsServer méthode

Returns a Boolean that indicates whether the specified folder already exists on the file system.

Espace de noms :  Microsoft.SqlServer.Dts.Runtime
Assembly :  Microsoft.SqlServer.ManagedDTS (dans Microsoft.SqlServer.ManagedDTS.dll)

Syntaxe

'Déclaration
Public Function FolderExistsOnDtsServer ( _
    sFolderName As String, _
    sServerName As String _
) As Boolean
'Utilisation
Dim instance As Application
Dim sFolderName As String
Dim sServerName As String
Dim returnValue As Boolean

returnValue = instance.FolderExistsOnDtsServer(sFolderName, _
    sServerName)
public bool FolderExistsOnDtsServer(
    string sFolderName,
    string sServerName
)
public:
bool FolderExistsOnDtsServer(
    String^ sFolderName, 
    String^ sServerName
)
member FolderExistsOnDtsServer : 
        sFolderName:string * 
        sServerName:string -> bool 
public function FolderExistsOnDtsServer(
    sFolderName : String, 
    sServerName : String
) : boolean

Paramètres

  • sFolderName
    Type : System. . :: . .String
    The name of the folder you are looking for. For example, to see if a folder name myFolder exists under the File System folder, use the escaped string, @"\\File System\\myFolder".

Valeur de retour

Type : System. . :: . .Boolean
true if the folder specified exists on the server; false if the folder does not exist.

Exemples

The following code example queries the File System to determine whether a folder that was created previously, named myFolder, exists.

class PackageTest
    {
        static void Main(string[] args)
        {
            Application app = new Application();
            Package p = app.LoadPackage(pkg, null);

            String folderName = @"\File System\myFolder";
            String serverName = "yourserver";
            Boolean folderExists = app.FolderExistsOnDtsServer(folderName, serverName);
            Console.WriteLine("Folder exists? " + folderExists);
        }
    }
Class PackageTest
        Sub Main(ByVal args() As String)
            Dim app As Application =  New Application() 
            Dim p As Package =  app.LoadPackage(pkg,Nothing) 
 
            Dim folderName As String =  "\File System\myFolder" 
            Dim serverName As String =  "yourserver" 
            Dim folderExists As Boolean =  app.FolderExistsOnDtsServer(folderName,serverName) 
            Console.WriteLine("Folder exists? " + folderExists)
        End Sub
End Class

Sample Output:

Folder exists? True