Поделиться через


Application.RenameFolderOnDtsServer(String, String, String, String) Метод

Определение

Переименовывает папку на указанном экземпляре SQL Server.

public:
 void RenameFolderOnDtsServer(System::String ^ sParent, System::String ^ sOldName, System::String ^ sNewName, System::String ^ sServerName);
public void RenameFolderOnDtsServer (string sParent, string sOldName, string sNewName, string sServerName);
member this.RenameFolderOnDtsServer : string * string * string * string -> unit
Public Sub RenameFolderOnDtsServer (sParent As String, sOldName As String, sNewName As String, sServerName As String)

Параметры

sParent
String

Имя родительской папки.

sOldName
String

Имя существующей папки.

sNewName
String

Новое имя папки.

sServerName
String

Имя сервера, на котором расположена папка.

Примеры

В следующем примере кода создается папка в иерархии служб Integration Services, проверяется, что папка создана, переименовывает ее, проверяет, распознает ли старое имя как папку, а затем проверяет, найдена ли новая папка.

static void Main(string[] args)  
        {  
            // Create a folder named myOldFolder.  
            Application app = new Application();  
            app.CreateFolderOnDtsServer(@"\File System\", "myOldFolder", "yourserver");  

            // Verify that creation was successful.  
            Boolean folderExists = app.FolderExistsOnDtsServer(@"File System\myOldFolder", "yourserver");  
            Console.WriteLine("Folder exists? " + folderExists);  

            // Rename myOldFolder to myNewFolder.  
            app.RenameFolderOnDtsServer(@"File System", "myOldFolder", "myNewFolder", "yourserver");  

            // Verify that the old folder still exists.  
            folderExists = app.FolderExistsOnDtsServer(@"File System\myOldFolder", "yourserver");  
            Console.WriteLine("Old, renamed folder exists? " + folderExists);  

            // Verify that the folder exists with the new name.   
            folderExists = app.FolderExistsOnDtsServer(@"File System\myNewFolder", "yourserver");  
            Console.WriteLine("New folder exists? " + folderExists);  
        }  
Shared  Sub Main(ByVal args() As String)  
    ' Create a folder named myOldFolder.  
    Dim app As Application =  New Application()   
    app.CreateFolderOnDtsServer("\File System\", "myOldFolder", "yourserver")  

    ' Verify that creation was successful.  
    Dim folderExists As Boolean =  app.FolderExistsOnDtsServer("File System\myOldFolder","yourserver")   
    Console.WriteLine("Folder exists? " + folderExists)  

    ' Rename myOldFolder to myNewFolder.  
    app.RenameFolderOnDtsServer("File System", "myOldFolder", "myNewFolder", "yourserver")  

    ' Check if the old folder still exists.  
    folderExists = app.FolderExistsOnDtsServer("File System\myOldFolder", "yourserver")  
    Console.WriteLine("Old, renamed folder exists? " + folderExists)  

    ' Verify that the folder exists with the new name.   
    folderExists = app.FolderExistsOnDtsServer("File System\myNewFolder", "yourserver")  
    Console.WriteLine("New folder exists? " + folderExists)  
End Sub  

Образец вывода:

Folder exists? True

Old, renamed folder exists? False

New folder exists? True

Применяется к