Application.DataTypeInfoFromDataType(DataType) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
重要
此 API 不符合 CLS 規範。
傳回指定之資料類型的 DataTypeInfo 物件。
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
參數
- dt
- DataType
資料類型。
傳回
DataTypeInfo 物件。
- 屬性
範例
下列程式碼範例會取出型別的名稱,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
範例輸出:
DataType = four-byte signed integer
備註
這個方法可讓您取得特定資料類型的資料類型資訊。 例如,如果您在參數中傳遞 "DT_I4" dt ,傳回值就是包含 " DataTypeInfo DT_I4" 列舉名稱和類型名稱 "四位元組帶正負號整數" 的物件。 這項資訊適用于在使用者介面或錯誤訊息中顯示類型資訊。 如需有關資料類型的詳細資訊,請參閱< Integration Services Data Types>。
給呼叫者的注意事項
這種方法需要將 Microsoft SqlServer. 封裝加入至專案。 在 c # 程式碼範例中,指示詞 using 已使用變數( 包裝函式)將此命名空間設為別名。