Bagikan melalui


Application.DataTypeInfoFromDataType(DataType) Metode

Definisi

Penting

API ini bukan kompatibel CLS.

Mengembalikan DataTypeInfo objek untuk jenis data yang ditentukan.

public:
 Microsoft::SqlServer::Dts::Runtime::DataTypeInfo ^ DataTypeInfoFromDataType(Microsoft::SqlServer::Dts::Runtime::Wrapper::DataType dt);
[System.CLSCompliant(false)]
public Microsoft.SqlServer.Dts.Runtime.DataTypeInfo DataTypeInfoFromDataType (Microsoft.SqlServer.Dts.Runtime.Wrapper.DataType dt);
[<System.CLSCompliant(false)>]
member this.DataTypeInfoFromDataType : Microsoft.SqlServer.Dts.Runtime.Wrapper.DataType -> Microsoft.SqlServer.Dts.Runtime.DataTypeInfo
Public Function DataTypeInfoFromDataType (dt As DataType) As DataTypeInfo

Parameter

dt
DataType

Jenis data.

Mengembalikan

Objek DataTypeInfo.

Atribut

Contoh

Contoh kode berikut mengambil nama jenis, DT_I4.

#region Using directives  
using System;  
using System.Collections.Generic;  
using System.Text;  
using Microsoft.SqlServer.Dts.Runtime;  
using Wrapper = Microsoft.SqlServer.Dts.Runtime.Wrapper;  
#endregion  

namespace Application_and_Package  
{  
    class PackageTest  
    {  
        static void Main(string[] args)  
        {  
            Application app = new Application();  
            DataTypeInfo dti = app.DataTypeInfoFromDataType(Wrapper.DataType.DT_I4);  
           Console.WriteLine("DataType = " + dti.TypeName);  
        }  
    }  
}  
#Region "Using directives  
Imports System  
Imports System".Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  
Imports Wrapper = Microsoft.SqlServer.Dts.Runtime.Wrapper  
#End Region  

Namespace Application_and_Package  
    Class PackageTest  
        Sub Main(ByVal args() As String)  
            Dim app As Application =  New Application()   
            Dim dti As DataTypeInfo =  app.DataTypeInfoFromDataType(Wrapper.DataType.DT_I4)   
           Console.WriteLine("DataType = " + dti.TypeName)  
        End Sub  
    End Class  
End Namespace  

Contoh Output:

DataType = four-byte signed integer

Keterangan

Metode ini memungkinkan Anda mendapatkan informasi jenis data untuk jenis data tertentu. Misalnya, jika Anda meneruskan "DT_I4" dalam dt parameter , nilai yang dikembalikan adalah DataTypeInfo objek yang berisi nama enumerasi "DT_I4" dan nama jenis "bilangan bulat bertanda empat byte". Informasi ini berguna untuk menampilkan informasi jenis di antarmuka pengguna atau pesan kesalahan. Untuk informasi selengkapnya tentang jenis data, lihat Jenis Data Layanan Integrasi.

Catatan Bagi Pemanggil

Metode ini memerlukan penambahan Microsoft.SqlServer.Dts.Runtime.Wrapper ke proyek. Dalam contoh kode C#, direktif using telah alias namespace layanan ini dengan variabel , Wrapper.

Berlaku untuk