语言

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

或者,连接到集成服务服务器,展开 存储包,然后再展开 MSDB。 新文件夹中会列出该名称 strNewFolderName

适用于