Application.FolderExistsOnSqlServer(String, String, String, String) 메서드

정의

지정된 폴더가 SQL Server 인스턴스에 이미 있는지 여부를 나타내는 부울을 반환합니다.

public:
 bool FolderExistsOnSqlServer(System::String ^ strFolderName, System::String ^ strServerName, System::String ^ strServerUserName, System::String ^ strServerPassword);
public bool FolderExistsOnSqlServer (string strFolderName, string strServerName, string strServerUserName, string strServerPassword);
member this.FolderExistsOnSqlServer : string * string * string * string -> bool
Public Function FolderExistsOnSqlServer (strFolderName As String, strServerName As String, strServerUserName As String, strServerPassword As String) As Boolean

매개 변수

strFolderName
String

찾으려는 폴더입니다.

strServerName
String

패키지를 검색할 SQL Server 인스턴스의 이름입니다.

strServerUserName
String

SQL Server 인스턴스에 대해 인증할 사용자 이름입니다.

strServerPassword
String

지정된 strServerUserName의 암호입니다.

반환

지정된 SQL Server 인스턴스에 폴더가 있으면 true입니다. 폴더가 없으면 false입니다.

예제

다음 코드 예제에서는 SQL Server 폴더를 만들고 이름을 바꾼 다음 제거합니다. 또한 .을 사용하여 FolderExistsOnSqlServer폴더가 있는지 확인합니다.

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();  
            app.CreateFolderOnSqlServer("\\", "myNewFolder", "yourserver", null, null);  

            // Verify that the folder was created.  
            Boolean ssFolder = app.FolderExistsOnSqlServer("\\myNewFolder", "yourserver", null, null);  
            Console.WriteLine("myNewFolderExists? " + ssFolder);  

            // Rename the myNewFolder to myRenamedFolder.   
            app.RenameFolderOnSqlServer("\\", "myNewFolder", "myRenamedFolder", "yourserver", null, null);  

            // Verify that the old folder does not exist.  
            ssFolder = app.FolderExistsOnSqlServer("\\myNewFolder", "yourserver", null, null);  
            Console.WriteLine("myNewFolderExists has been renamed but still exists? " + ssFolder);  

            // Verify that a folder with the new name does exist.  
            ssFolder = app.FolderExistsOnSqlServer("\\myRenamedFolder", "yourserver", null, null);  
            Console.WriteLine("myRenamedFolder now exists? " + ssFolder);  

            // Delete the folder.  
            app.RemoveFolderFromSqlServer("\\myRenamedFolder", "yourserver", null, null);  

            // Verify that the folder was removed.  
            ssFolder = app.FolderExistsOnSqlServer("\\myRenamedFolder", "yourserver", null, null);  
            Console.WriteLine("myRenamedFolder still exists? " + ssFolder);  
        }  
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()   
            app.CreateFolderOnSqlServer("\\", "myNewFolder", "yourserver", Nothing, Nothing)  

            ' Verify that the folder was created.  
            Dim ssFolder As Boolean =  app.FolderExistsOnSqlServer("\\myNewFolder","yourserver",Nothing,Nothing)   
            Console.WriteLine("myNewFolderExists? " + ssFolder)  

            ' Rename the myNewFolder to myRenamedFolder.   
            app.RenameFolderOnSqlServer("\\", "myNewFolder", "myRenamedFolder", "yourserver", Nothing, Nothing)  

            ' Verify that the old folder does not exist.  
            ssFolder = app.FolderExistsOnSqlServer("\\myNewFolder", "yourserver", Nothing, Nothing)  
            Console.WriteLine("myNewFolderExists has been renamed but still exists? " + ssFolder)  

            ' Verify that a folder with the new name does exist.  
            ssFolder = app.FolderExistsOnSqlServer("\\myRenamedFolder", "yourserver", Nothing, Nothing)  
            Console.WriteLine("myRenamedFolder now exists? " + ssFolder)  

            ' Delete the folder.  
            app.RemoveFolderFromSqlServer("\\myRenamedFolder", "yourserver", Nothing, Nothing)  

            ' Verify that the folder was removed.  
            ssFolder = app.FolderExistsOnSqlServer("\\myRenamedFolder", "yourserver", Nothing, Nothing)  
            Console.WriteLine("myRenamedFolder still exists? " + ssFolder)  
End Sub  

샘플 출력:

myNewFolderExists? True

myNewFolderExists has been renamed but still exists? False

myRenamedFolder now exists? True

myRenamedFolder still exists? False

적용 대상