Compartir a través de


Application.RenameFolderOnDtsServer(String, String, String, String) Método

Definición

Cambia el nombre de una carpeta en la instancia especificada de 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)

Parámetros

sParent
String

Nombre de la carpeta principal.

sOldName
String

Nombre de la carpeta existente.

sNewName
String

Nombre nuevo de la carpeta.

sServerName
String

Nombre del servidor donde se encuentra la carpeta.

Ejemplos

En el ejemplo de código siguiente se crea una carpeta dentro de la jerarquía de servicios de Integration Services, se comprueba que se ha creado la carpeta, se le cambia el nombre, se comprueba que el nombre anterior sigue siendo una carpeta y, a continuación, se comprueba si se encuentra el nuevo nombre de carpeta.

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  

Salida del ejemplo:

Folder exists? True

Old, renamed folder exists? False

New folder exists? True

Se aplica a