Package.Configurations 属性

定义

获取包的配置集合。 一个包可以有与之关联的多个配置。 此属性为只读。

public:
 property Microsoft::SqlServer::Dts::Runtime::Configurations ^ Configurations { Microsoft::SqlServer::Dts::Runtime::Configurations ^ get(); };
public Microsoft.SqlServer.Dts.Runtime.Configurations Configurations { get; }
member this.Configurations : Microsoft.SqlServer.Dts.Runtime.Configurations
Public ReadOnly Property Configurations As Configurations

属性值

Configurations

包的配置集合。

示例

以下示例加载示例包,然后返回与包关联的配置数。

class PackageTest  
    {  
        static void Main(string[] args)  
        {  
            // The variable pkg points to the location of the  
            // ExecuteProcess package sample installed with the  
            // samples.  
            string pkg = @"C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";  

            Application app = new Application();  
            Package p = app.LoadPackage(pkg, null);  

            int n = p.Configurations.Count;  
            Console.WriteLine("Number of configurations = " + n);  
        }  
    }  
Class PackageTest  
        Shared  Sub Main(ByVal args() As String)  
            ' The variable pkg points to the location of the  
            ' ExecuteProcess package sample installed with the  
            ' 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()   
            Dim p As Package =  app.LoadPackage(pkg,Nothing)   

            Dim n As Integer =  p.Configurations.Count   
            Console.WriteLine("Number of configurations = " + n)  
        End Sub  
End Class  

注解

通过每个配置,可以从外部源(例如从配置文件、环境变量或注册表项)设置包变量。 有关包配置的详细信息,请参阅 “创建包配置”。

适用于