DTSConfigurationType 枚举

定义

指定可以保存包的配置的方式。

public enum class DTSConfigurationType
public enum DTSConfigurationType
type DTSConfigurationType = 
Public Enum DTSConfigurationType
继承
DTSConfigurationType

字段

ConfigFile 1

指定配置存储在配置文件中。 在“SSIS 包配置向导”的“配置文件名”列中,可以指定向导生成的配置文件的位置和名称。

EnvVariable 2

指定配置存储在环境变量中。

IConfigFile 5

指定配置存储在一个环境变量中,该变量包含有关配置平面文件的信息。

IIniFile 10

此成员留待将来使用。

IniFile 8

此成员留待将来使用。

IParentVariable 4

指定配置信息存储在一个环境变量中,该变量包含有关包变量的信息。

IRegEntry 6

指定配置信息存储在一个环境变量中,该变量包含有关注册表项的信息。

ISqlServer 9

指定配置信息的位置存储在包含有关SQL Server信息的环境变量中。

ParentVariable 0

指定配置信息存储在包变量中。

RegEntry 3

指定配置信息存储在注册表项中。

SqlServer 7

指定配置存储在 SQL Server msdb 数据库中。 此字段为常数。

示例

下面的代码示例创建包,启用配置,并启用配置文件的导出。 它会向包Configurations集合添加新Configuration项,并在配置上设置多个属性,包括ConfigurationType使用此枚举的属性。 保存并重新加载包后,将显示配置属性。

using System;  
using System.Collections.Generic;  
using System.Text;  
using Microsoft.SqlServer.Dts.Runtime;  
using Microsoft.SqlServer.Dts.Tasks.BulkInsertTask;  

namespace configuration_API  
{  
    class Program  
    {      
        static void Main(string[] args)  
        {  
        // Create a package and set two properties.  
            Package pkg = new Package();  
            pkg.EnableConfigurations = true;  
            pkg.ExportConfigurationFile(@"C:\conf.xml");  

            // Create a variable object and add it to the   
            // package Variables collection.  
            Variable varPkg = pkg.Variables.Add("var", false, "", 100);  
            varPkg.Value = 1;  
            string packagePathToVariable = varPkg.GetPackagePath();  

            // Create a configuration object and add it to the   
           // package configuration collection.  
            Configuration config = pkg.Configurations.Add();  

           // Set properties on the configuration object.  
            config.ConfigurationString = "conf.xml";  
            config.Description = "My configuration description";  
            config.ConfigurationType = DTSConfigurationType.ConfigFile;  
            config.PackagePath = packagePathToVariable;  

            // Save the package and its configuration.  
            Application app = new Application();  
            app.SaveToXml(@"c:\pkg.xml", pkg, null);  

            // Reload the package.  
            Package p1 = app.LoadPackage(@"c:\pkg.xml", null);  

            // Review the configuration information.  
            Configurations configs_After = pkg.Configurations;  
            foreach(Configuration confAfter in configs_After)  
            {  
                Console.WriteLine("ConfigurationString is {0}", confAfter.ConfigurationString);  
                Console.WriteLine("ConfigurationType is {0}", confAfter.ConfigurationType);  
                Console.WriteLine("CreationName is {0}", confAfter.CreationName);  
                Console.WriteLine("Description is {0}", confAfter.Description);  
                Console.WriteLine("Assigned ID is {0}", confAfter.ID);  
                Console.WriteLine("Name is {0}", confAfter.Name);  
            }  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  
Imports Microsoft.SqlServer.Dts.Tasks.BulkInsertTask  

Namespace configuration_API  
    Class Program      
        Shared  Sub Main(ByVal args() As String)  
        ' Create a package and set two properties.  
            Dim pkg As Package =  New Package()   
            pkg.EnableConfigurations = True  
            pkg.ExportConfigurationFile("C:\conf.xml")  

            ' Create a variable object and add it to the   
            ' package Variables collection.  
            Dim varPkg As Variable =  pkg.Variables.Add("var",False,"",100)   
            varPkg.Value = 1  
            Dim packagePathToVariable As String =  varPkg.GetPackagePath()   

            ' Create a configuration object and add it to the   
           ' package configuration collection.  
            Dim config As Configuration =  pkg.Configurations.Add()   

           ' Set properties on the configuration object.  
            config.ConfigurationString = "conf.xml"  
            config.Description = "My configuration description"  
            config.ConfigurationType = DTSConfigurationType.ConfigFile  
            config.PackagePath = packagePathToVariable  

            ' Save the package and its configuration.  
            Dim app As Application =  New Application()   
            app.SaveToXml("c:\pkg.xml", pkg, Nothing)  

            ' Reload the package.  
            Dim p1 As Package =  app.LoadPackage("c:\pkg.xml",Nothing)   

            ' Review the configuration information.  
            Dim configs_After As Configurations =  pkg.Configurations   
            Dim confAfter As Configuration  
            For Each confAfter In configs_After  
                Console.WriteLine("ConfigurationString is {0}", confAfter.ConfigurationString)  
                Console.WriteLine("ConfigurationType is {0}", confAfter.ConfigurationType)  
                Console.WriteLine("CreationName is {0}", confAfter.CreationName)  
                Console.WriteLine("Description is {0}", confAfter.Description)  
                Console.WriteLine("Assigned ID is {0}", confAfter.ID)  
                Console.WriteLine("Name is {0}", confAfter.Name)  
            Next  
        End Sub  
    End Class  
End Namespace  

示例输出:

变量 var = 1 的值

ConfigurationString conf.xml

ConfigurationType 为 ConfigFile

CreationName 为

说明是“我的配置”说明

分配的 ID 为 {9CF65E37-0833-44CD-A99D-EBFE38FAB31B}

名称为 {9CF65E37-0833-44CD-A99D-EBFE38FAB31B}

包路径为 \Package.Variables[::var]

注解

Integration Services 支持为包指定配置的许多不同方法。 有关详细信息,请参阅 创建包配置

适用于