DTSConfigurationType Enum

Definisi

Menentukan cara konfigurasi untuk paket dapat disimpan.

public enum class DTSConfigurationType
public enum DTSConfigurationType
type DTSConfigurationType = 
Public Enum DTSConfigurationType
Warisan
DTSConfigurationType

Bidang

ConfigFile 1

Menentukan bahwa konfigurasi disimpan dalam file konfigurasi. Di Wizard Konfigurasi Paket SSIS, kolom Nama File Konfigurasi adalah tempat Anda menentukan lokasi dan nama file konfigurasi yang dihasilkan wizard.

EnvVariable 2

Menentukan bahwa konfigurasi disimpan dalam variabel lingkungan.

IConfigFile 5

Menentukan bahwa konfigurasi disimpan dalam variabel lingkungan yang berisi informasi tentang file datar konfigurasi.

IIniFile 10

Anggota ini dicadangkan untuk digunakan di masa mendatang.

IniFile 8

Anggota ini dicadangkan untuk digunakan di masa mendatang.

IParentVariable 4

Menentukan bahwa informasi konfigurasi disimpan dalam variabel lingkungan yang berisi informasi tentang variabel paket.

IRegEntry 6

Menentukan bahwa informasi konfigurasi disimpan dalam variabel lingkungan yang berisi informasi tentang entri registri.

ISqlServer 9

Menentukan bahwa lokasi informasi konfigurasi disimpan dalam variabel lingkungan yang berisi informasi tentang SQL Server .

ParentVariable 0

Menentukan bahwa informasi konfigurasi disimpan dalam variabel paket.

RegEntry 3

Menentukan bahwa informasi konfigurasi disimpan dalam entri registri.

SqlServer 7

Menentukan bahwa konfigurasi disimpan dalam database SQL Server msdb. Bidang ini konstan.

Contoh

Contoh kode berikut membuat paket, mengaktifkan konfigurasi, dan mengaktifkan ekspor file konfigurasi. Ini menambahkan baru Configuration ke koleksi paket Configurations , dan mengatur beberapa properti pada konfigurasi, termasuk ConfigurationType, yang menggunakan enumerasi ini. Setelah menyimpan dan memuat ulang paket, properti konfigurasi ditampilkan.

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  

Contoh Output:

Nilai variabel var = 1

ConfigurationString conf.xml

ConfigurationType adalah ConfigFile

CreationName adalah

Deskripsi adalah Deskripsi konfigurasi saya

ID yang ditetapkan adalah {9CF65E37-0833-44CD-A99D-EBFE38FAB31B}

Nama adalah {9CF65E37-0833-44CD-A99D-EBFE38FAB31B}

Jalur Paket adalah \Package.Variables[::var]

Keterangan

Layanan Integrasi mendukung berbagai cara untuk menentukan konfigurasi untuk paket. Untuk informasi selengkapnya, lihat Membuat Konfigurasi Paket.

Berlaku untuk