Bagikan melalui


Application.RenameFolderOnDtsServer(String, String, String, String) Metode

Definisi

Mengganti nama folder pada instans SQL Server yang ditentukan.

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)

Parameter

sParent
String

Nama folder induk.

sOldName
String

Nama folder yang ada.

sNewName
String

Nama baru folder.

sServerName
String

Nama server tempat folder berada.

Contoh

Contoh kode berikut membuat folder dalam hierarki layanan Integration Services, memverifikasi bahwa folder telah dibuat, mengganti namanya, memverifikasi bahwa nama lama masih dikenali sebagai folder, lalu memverifikasi apakah nama folder baru ditemukan.

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  

Contoh Output:

Folder exists? True

Old, renamed folder exists? False

New folder exists? True

Berlaku untuk