Application.CreateFolderOnSqlServer 方法

定义

在 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)

参数

strParent
String

父文件夹的名称。 如果您想要在“文件系统”节点之下创建一个文件夹,请使用 CreateFolderOnDtsServer(String, String, String) 方法。

strNewFolderName
String

要创建的文件夹的名称。

strServerName
String

SQL Server 实例的名称。

strServerUserName
String

对服务器进行身份验证时要使用的用户名。

strServerPassword
String

strServerUserName 帐户关联的密码。

示例

下面的代码示例演示如何创建名为“文件夹”myNewFolder.的新文件夹存储在 SQL Server msdb 数据库中的 sysssispackagefolders 表中。

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  

注解

若要验证文件夹是否已创建,请使用以下 Transact-SQL 查询,该查询选择存储在文件系统文件夹中的所有包。

select * from sysssispackagefolders

或者,连接到 Integration Services 服务器,展开 存储包,然后展开 MSDB。 将列出具有给定 strNewFolderName 名称的新文件夹。

适用于