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 传递“DT_I4”,返回值是 DataTypeInfo 包含枚举名“DT_I4”和类型名“四字节有符号整数”的对象。 这些信息对于在用户界面或错误信息中显示类型信息非常有用。 有关数据类型的详细信息,请参阅 Integration Services Data Types。
调用方说明
这种方法需要添加Microsoft。SqlServer.Dts.Runtime.Wrapper 到项目。 在 C# 代码示例中, using 指令用变量 WrapperAlias-size 了命名空间。