Application.CreateFolderOnSqlServer Metodo

Definizione

Crea una cartella sull'istanza specificata di SQL Server.

public:
 void CreateFolderOnSqlServer(System::String ^ strParent, System::String ^ strNewFolderName, System::String ^ strServerName, System::String ^ strServerUserName, System::String ^ strServerPassword);
public void CreateFolderOnSqlServer(string strParent, string strNewFolderName, string strServerName, string strServerUserName, string strServerPassword);
member this.CreateFolderOnSqlServer : string * string * string * string * string -> unit
Public Sub CreateFolderOnSqlServer (strParent As String, strNewFolderName As String, strServerName As String, strServerUserName As String, strServerPassword As String)

Parametri

strParent
String

Nome della cartella padre. Se vuoi creare una cartella sotto il nodo File System, usa il CreateFolderOnDtsServer(String, String, String) metodo.

strNewFolderName
String

Il nome della cartella da creare.

strServerName
String

Nome dell'istanza di SQL Server.

strServerUserName
String

Il nome utente da usare quando si autentica sul server.

strServerPassword
String

La password associata all'account strServerUserName .

Esempio

Il seguente esempio di codice mostra come creare una nuova cartella chiamata myNewFolder. La cartella è memorizzata nella tabella sysssispackagefolders nel database msdb di SQL Server.

class ApplicationTests  
    {  
        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();  

            //Create a folder, myNewFolder, in the   
            // SQL Server msdb database.  
            app.CreateFolderOnSqlServer("\\", "myNewFolder", "yourserver", null, null);  
        }  
    }  
Class ApplicationTests  
        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()   

            'Create a folder, myNewFolder, in the   
            ' SQL Server msdb database.  
            app.CreateFolderOnSqlServer("\\", "myNewFolder", "yourserver", Nothing, Nothing)  
        End Sub  
End Class  

Commenti

Per verificare che la cartella sia stata creata, utilizzare la seguente Transact-SQL query, che seleziona tutti i pacchetti memorizzati nella cartella File System.

select * from sysssispackagefolders

Oppure, collegarsi al server Integration Services, espandere i Package Memorizzati e poi espandere MSDB. La nuova cartella con il nome indicato strNewFolderName sarà elencata.

Si applica a