Application.RemoveFolderFromSqlServer(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.
Rimuove la cartella specificata dall'istanza di SQL Server specificata.
public:
void RemoveFolderFromSqlServer(System::String ^ strFolderName, System::String ^ strServerName, System::String ^ strServerUserName, System::String ^ strServerPassword);
public void RemoveFolderFromSqlServer (string strFolderName, string strServerName, string strServerUserName, string strServerPassword);
member this.RemoveFolderFromSqlServer : string * string * string * string -> unit
Public Sub RemoveFolderFromSqlServer (strFolderName As String, strServerName As String, strServerUserName As String, strServerPassword As String)
Parametri
- strFolderName
- String
Nome della cartella da eliminare.
- strServerName
- String
Nome dell'istanza di SQL Server da cui rimuovere la cartella.
- strServerUserName
- String
Nome utente da autenticare nell'istanza di SQL Server.
- strServerPassword
- String
Password per l'account strServerUserName
specificato.
Esempio
Nell'esempio di codice seguente viene creata una cartella in SQL Server, rinominata e quindi rimossa tramite RemoveFolderFromSqlServer. Verifica anche l'esistenza della cartella più volte usando FolderExistsOnSqlServer.
static void Main(string[] args)
{
// The variable pkg points to the location
// of the ExecuteProcess package sample
// that is installed with the SSIS samples.
string pkg = @"C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";
Application app = new Application();
app.CreateFolderOnSqlServer("\\", "myNewFolder", "yourserver", null, null);
// Verify that the folder was created.
Boolean ssFolder = app.FolderExistsOnSqlServer("\\myNewFolder", "yourserver", null, null);
Console.WriteLine("myNewFolderExists? " + ssFolder);
// Rename myNewFolder to myRenamedFolder.
app.RenameFolderOnSqlServer("\\", "myNewFolder", "myRenamedFolder", "yourserver", null, null);
// Verify that the old folder does not exist.
ssFolder = app.FolderExistsOnSqlServer("\\myNewFolder", "yourserver", null, null);
Console.WriteLine("myNewFolderExists has been renamed but still exists? " + ssFolder);
// Verify that a folder with the new name does exist.
ssFolder = app.FolderExistsOnSqlServer("\\myRenamedFolder", "yourserver", null, null);
Console.WriteLine("myRenamedFolder now exists? " + ssFolder);
// Delete the folder.
app.RemoveFolderFromSqlServer("\\myRenamedFolder", "yourserver", null, null);
// Verify that the folder was removed.
ssFolder = app.FolderExistsOnSqlServer("\\myRenamedFolder", "yourserver", null, null);
Console.WriteLine("myRenamedFolder still exists? " + ssFolder);
}
Shared Sub Main(ByVal args() As String)
' The variable pkg points to the location
' of the ExecuteProcess package sample
' that is installed with the SSIS samples.
Dim pkg As String = "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx"
Dim app As Application = New Application()
app.CreateFolderOnSqlServer("\\", "myNewFolder", "yourserver", Nothing, Nothing)
' Verify that the folder was created.
Dim ssFolder As Boolean = app.FolderExistsOnSqlServer("\\myNewFolder","yourserver",Nothing,Nothing)
Console.WriteLine("myNewFolderExists? " + ssFolder)
' Rename myNewFolder to myRenamedFolder.
app.RenameFolderOnSqlServer("\\", "myNewFolder", "myRenamedFolder", "yourserver", Nothing, Nothing)
' Verify that the old folder does not exist.
ssFolder = app.FolderExistsOnSqlServer("\\myNewFolder", "yourserver", Nothing, Nothing)
Console.WriteLine("myNewFolderExists has been renamed but still exists? " + ssFolder)
' Verify that a folder with the new name does exist.
ssFolder = app.FolderExistsOnSqlServer("\\myRenamedFolder", "yourserver", Nothing, Nothing)
Console.WriteLine("myRenamedFolder now exists? " + ssFolder)
' Delete the folder.
app.RemoveFolderFromSqlServer("\\myRenamedFolder", "yourserver", Nothing, Nothing)
' Verify that the folder was removed.
ssFolder = app.FolderExistsOnSqlServer("\\myRenamedFolder", "yourserver", Nothing, Nothing)
Console.WriteLine("myRenamedFolder still exists? " + ssFolder)
End Sub
Esempio di output
myNewFolderExists? True
myNewFolderExists has been renamed but still exists? False
myRenamedFolder now exists? True
myRenamedFolder still exists? False