다음을 통해 공유


Application.RemoveFolderFromSqlServer 메서드

Removes the specified folder from the specified instance of SQL Server.

네임스페이스:  Microsoft.SqlServer.Dts.Runtime
어셈블리:  Microsoft.SqlServer.ManagedDTS(Microsoft.SqlServer.ManagedDTS.dll)

구문

‘선언
Public Sub RemoveFolderFromSqlServer ( _
    strFolderName As String, _
    strServerName As String, _
    strServerUserName As String, _
    strServerPassword As String _
)
‘사용 방법
Dim instance As Application 
Dim strFolderName As String 
Dim strServerName As String 
Dim strServerUserName As String 
Dim strServerPassword As String

instance.RemoveFolderFromSqlServer(strFolderName, _
    strServerName, strServerUserName, _
    strServerPassword)
public void RemoveFolderFromSqlServer(
    string strFolderName,
    string strServerName,
    string strServerUserName,
    string strServerPassword
)
public:
void RemoveFolderFromSqlServer(
    String^ strFolderName, 
    String^ strServerName, 
    String^ strServerUserName, 
    String^ strServerPassword
)
member RemoveFolderFromSqlServer : 
        strFolderName:string * 
        strServerName:string * 
        strServerUserName:string * 
        strServerPassword:string -> unit
public function RemoveFolderFromSqlServer(
    strFolderName : String, 
    strServerName : String, 
    strServerUserName : String, 
    strServerPassword : String
)

매개 변수

  • strFolderName
    유형: System.String
    The name of the folder to delete.
  • strServerName
    유형: System.String
    The name of the instance of SQL Server to remove the folder from.
  • strServerUserName
    유형: System.String
    The user name to authenticate against the instance of SQL Server.
  • strServerPassword
    유형: System.String
    The password for the specified strServerUserName.

The following code example creates a folder on SQL Server, renames it, and then removes it by using RemoveFolderFromSqlServer. It also verifies the existence of the folder several times by using 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 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);
        }
Shared  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 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

Sample Output:

myNewFolderExists? True

myNewFolderExists has been renamed but still exists? False

myRenamedFolder now exists? True

myRenamedFolder still exists? False

참고 항목

참조

Application 클래스

Microsoft.SqlServer.Dts.Runtime 네임스페이스