DataType Enum

Definition

public enum class DataType
public enum DataType
type DataType = 
Public Enum DataType
Inheritance
DataType

Fields

DT_BOOL 11
DT_BYREF_BOOL 16395
DT_BYREF_CY 16390
DT_BYREF_DATE 16391
DT_BYREF_DBDATE 16517
DT_BYREF_DBTIME 16518
DT_BYREF_DBTIME2 16520
DT_BYREF_DBTIMESTAMP 16519
DT_BYREF_DBTIMESTAMP2 16522
DT_BYREF_DBTIMESTAMPOFFSET 16521
DT_BYREF_DECIMAL 16398
DT_BYREF_FILETIME 16448
DT_BYREF_GUID 16456
DT_BYREF_I1 16400
DT_BYREF_I2 16386
DT_BYREF_I4 16387
DT_BYREF_I8 16404
DT_BYREF_NUMERIC 16515
DT_BYREF_R4 16388
DT_BYREF_R8 16389
DT_BYREF_UI1 16401
DT_BYREF_UI2 16402
DT_BYREF_UI4 16403
DT_BYREF_UI8 16405
DT_BYTES 128
DT_CY 6
DT_DATE 7
DT_DBDATE 133
DT_DBTIME 134
DT_DBTIME2 145
DT_DBTIMESTAMP 135
DT_DBTIMESTAMP2 304
DT_DBTIMESTAMPOFFSET 146
DT_DECIMAL 14
DT_EMPTY 0
DT_FILETIME 64
DT_GUID 72
DT_I1 16
DT_I2 2
DT_I4 3
DT_I8 20
DT_IMAGE 301
DT_NTEXT 303
DT_NULL 1
DT_NUMERIC 131
DT_R4 4
DT_R8 5
DT_STR 129
DT_TEXT 302
DT_UI1 17
DT_UI2 18
DT_UI4 19
DT_UI8 21
DT_WSTR 130

Remarks

数据类型分为引用类型和值类型。Data types are divided into reference types and value types. 引用类型指向指定类型的对象。Reference types point to an object of the specified type. 值类型包含实际数据,而不是指向数据的指针。Value types contain the actual data, not a pointer to the data.

对于属于值类型的数据类型,有时需要指向其数据的指针,而不是数据本身。For those data types that are value types, there are times where you need a pointer to their data, not the data itself. 在成员表中,DT_BYREF * 成员是创建为指向值类型的指针的字段。In the member table, the DT_BYREF* members are fields that were created to be pointers to value types.

有关详细信息,请参阅在数据流中使用数据类型For more information, see Working with Data Types in the Data Flow.

Note

布尔值是逻辑值而非数字。Boolean values are logical values, not numbers. 虽然布尔值在某些环境中可能显示为数字,但它们并非以数字形式存储,而且不同的编程语言以不同的数值表示布尔值,.NET Framework 方法也是如此。Although Boolean values may be displayed as numbers in some environments, they are not stored as numbers, and various programming languages represent Boolean values as numeric values differently, as do the .NET Framework methods.

例如,Visual Basic 中可用的转换函数将 True 转换为 -1;但是 .NET Framework 中的 System.Convert.ToInt32 方法将 True 转换为 +1。For example, the conversion functions available in Visual Basic convert True to -1; however, the System.Convert.ToInt32 method in the .NET Framework converts True to +1. Integration Services 表达式语言将 True 转换为 -1。The Integration Services Expression Language converts True to -1.

若要避免错误或意外结果,不应编写依赖 TrueFalse 为特定数值的代码。To avoid errors or unexpected results, you should not write code that relies on particular numeric values for True and False. 如果可能,应将布尔变量的使用限制为与其设计意图对应的逻辑值。Wherever possible, you should restrict usage of Boolean variables to the logical values for which they are designed.

DT_DATE 数据类型是使用 8 字节浮点数字来实现的。The DT_DATE data type is implemented using an 8-byte floating-point number. 日以整数增量表示,从 1899 年 12 月 30 日开始,午夜时间为零点。Days are represented by whole number increments, starting with 30 December 1899, and midnight as time zero. 小时值以数字的小数部分的绝对值表示。Hour values are expressed as the absolute value of the fractional part of the number. 这意味着 DT_DATE 可以表示分钟、秒甚至毫秒。This means that DT_DATE can represent minutes, seconds, and even milliseconds as well. 但是,浮点值无法表示所有实数值;因此,DT_DATE 中可以显示的日期范围有限制。However, floating point value cannot represent all real values; therefore, there are limits on the range of dates that can be presented in DT_DATE.

DT_DBTIMESTAMPOFFSET 的数据类型也具有时区偏移量。The DT_DBTIMESTAMPOFFSET data type also has a time zone offset. 此偏移量指定时间相对于协调世界时 (UTC) 偏移的小时和分钟数。This offset specifies the number of hours and minutes that the time is offset from the Coordinated Universal Time (UTC). 系统使用时区偏移量获取本地时间。The time zone offset is used by the system to obtain the local time.

有关数据类型的详细信息,请参阅Integration Services 数据类型For more information about data types, see Integration Services Data Types.

Applies to