Application.RenameFolderOnDtsServer(String, String, String, String) Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Rinomina una cartella sull'istanza specificata di 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)
Parametri
- sParent
- String
Nome della cartella padre.
- sOldName
- String
Il nome della cartella esistente.
- sNewName
- String
Nuovo nome della cartella.
- sServerName
- String
Il nome del server dove si trova la cartella.
Esempio
Il seguente esempio di codice crea una cartella all'interno della gerarchia dei servizi di Integration Services, verifica che la cartella sia stata creata, la rinomina, verifica che il vecchio nome sia ancora riconosciuto come cartella e poi verifica se il nuovo nome della cartella è stato trovato.
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
Output di esempio:
Folder exists? True
Old, renamed folder exists? False
New folder exists? True