共用方式為


RenameFolderOnDtsServer 方法

Renames a folder on the specified instance of SQL Server.

命名空間:  Microsoft.SqlServer.Dts.Runtime
組件:  Microsoft.SqlServer.ManagedDTS (在 Microsoft.SqlServer.ManagedDTS.dll 中)

語法

'宣告
Public Sub RenameFolderOnDtsServer ( _
    sParent As String, _
    sOldName As String, _
    sNewName As String, _
    sServerName As String _
)
'用途
Dim instance As Application
Dim sParent As String
Dim sOldName As String
Dim sNewName As String
Dim sServerName As String

instance.RenameFolderOnDtsServer(sParent, _
    sOldName, sNewName, sServerName)
public void RenameFolderOnDtsServer(
    string sParent,
    string sOldName,
    string sNewName,
    string sServerName
)
public:
void RenameFolderOnDtsServer(
    String^ sParent, 
    String^ sOldName, 
    String^ sNewName, 
    String^ sServerName
)
member RenameFolderOnDtsServer : 
        sParent:string * 
        sOldName:string * 
        sNewName:string * 
        sServerName:string -> unit 
public function RenameFolderOnDtsServer(
    sParent : String, 
    sOldName : String, 
    sNewName : String, 
    sServerName : String
)

參數

範例

The following code example creates a folder within the Integration Services services hierarchy, verifies that the folder has been created, renames it, verifies that the old name is still recognized as a folder, and then verifies whether the new folder name is found.

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

Sample Output:

Folder exists? True

Old, renamed folder exists? False

New folder exists? True