DbType DbType DbType DbType Enum

定义

指定 .NET Framework 数据提供程序的字段、属性或 Parameter 对象的数据类型。Specifies the data type of a field, a property, or a Parameter object of a .NET Framework data provider.

public enum class DbType
public enum DbType
type DbType = 
Public Enum DbType
继承

字段

AnsiString AnsiString AnsiString AnsiString 0

非 Unicode 字符的可变长度流,范围在 1 到 8,000 个字符之间。A variable-length stream of non-Unicode characters ranging between 1 and 8,000 characters.

AnsiStringFixedLength AnsiStringFixedLength AnsiStringFixedLength AnsiStringFixedLength 22

非 Unicode 字符的固定长度流。A fixed-length stream of non-Unicode characters.

Binary Binary Binary Binary 1

二进制数据的可变长度流,范围在 1 到 8,000 个字节之间。A variable-length stream of binary data ranging between 1 and 8,000 bytes.

Boolean Boolean Boolean Boolean 3

简单类型,表示 truefalse 的布尔值。A simple type representing Boolean values of true or false.

Byte Byte Byte Byte 2

一个 8 位无符号整数,范围在 0 到 255 之间。An 8-bit unsigned integer ranging in value from 0 to 255.

Currency Currency Currency Currency 4

货币值,范围在 2 63(即 -922,337,203,685,477.5808)到 2 63 -1(即 +922,337,203,685,477.5807)之间,精度为千分之十个货币单位。A currency value ranging from -2 63 (or -922,337,203,685,477.5808) to 2 63 -1 (or +922,337,203,685,477.5807) with an accuracy to a ten-thousandth of a currency unit.

Date Date Date Date 5

表示日期值的类型。A type representing a date value.

DateTime DateTime DateTime DateTime 6

表示一个日期和时间值的类型。A type representing a date and time value.

DateTime2 DateTime2 DateTime2 DateTime2 26

日期和时间数据。Date and time data. 日期值范围从公元 1 年 1 月 1 日到公元 9999 年 12 月 31 日。Date value range is from January 1,1 AD through December 31, 9999 AD. 时间值范围从 00:00:00 到 23:59:59.9999999,精度为 100 毫微秒。Time value range is 00:00:00 through 23:59:59.9999999 with an accuracy of 100 nanoseconds.

DateTimeOffset DateTimeOffset DateTimeOffset DateTimeOffset 27

显示时区的日期和时间数据。Date and time data with time zone awareness. 日期值范围从公元 1 年 1 月 1 日到公元 9999 年 12 月 31 日。Date value range is from January 1,1 AD through December 31, 9999 AD. 时间值范围从 00:00:00 到 23:59:59.9999999,精度为 100 毫微秒。Time value range is 00:00:00 through 23:59:59.9999999 with an accuracy of 100 nanoseconds. 时区值范围从 -14:00 到 +14:00。Time zone value range is -14:00 through +14:00.

Decimal Decimal Decimal Decimal 7

简单类型,表示从 1.0 x 10 -28 到大约 7.9 x 10 28 且有效位数为 28 到 29 位的值。A simple type representing values ranging from 1.0 x 10 -28 to approximately 7.9 x 10 28 with 28-29 significant digits.

Double Double Double Double 8

浮点型,表示从大约 5.0 x 10 -324 到 1.7 x 10 308 且精度为 15 到 16 位的值。A floating point type representing values ranging from approximately 5.0 x 10 -324 to 1.7 x 10 308 with a precision of 15-16 digits.

Guid Guid Guid Guid 9

全局唯一标识符(或 GUID)。A globally unique identifier (or GUID).

Int16 Int16 Int16 Int16 10

整型,表示值介于 -32768 到 32767 之间的有符号 16 位整数。An integral type representing signed 16-bit integers with values between -32768 and 32767.

Int32 Int32 Int32 Int32 11

整型,表示值介于 -2147483648 到 2147483647 之间的 32 位有符号整数。An integral type representing signed 32-bit integers with values between -2147483648 and 2147483647.

Int64 Int64 Int64 Int64 12

整型,表示值介于-9223372036854775808 和 9223372036854775807 之间的 64 位有符号整数。An integral type representing signed 64-bit integers with values between -9223372036854775808 and 9223372036854775807.

Object Object Object Object 13

常规类型,表示任何没有由其他 DbType 值显式表示的引用或值类型。A general type representing any reference or value type not explicitly represented by another DbType value.

SByte SByte SByte SByte 14

整型,表示值介于 -128 到 127 之间的 8 位有符号整数。An integral type representing signed 8-bit integers with values between -128 and 127.

Single Single Single Single 15

浮点型,表示从大约 1.5 x 10 -45 到 3.4 x 10 38 且精度为 7 位的值。A floating point type representing values ranging from approximately 1.5 x 10 -45 to 3.4 x 10 38 with a precision of 7 digits.

String String String String 16

表示 Unicode 字符串的类型。A type representing Unicode character strings.

StringFixedLength StringFixedLength StringFixedLength StringFixedLength 23

Unicode 字符的定长串。A fixed-length string of Unicode characters.

Time Time Time Time 17

一个表示 SQL Server DateTime 值的类型。A type representing a SQL Server DateTime value. 如果要使用 SQL Server time 值,请使用 TimeIf you want to use a SQL Server time value, use Time.

UInt16 UInt16 UInt16 UInt16 18

整型,表示值介于 0 到 65535 之间的 16 位无符号整数。An integral type representing unsigned 16-bit integers with values between 0 and 65535.

UInt32 UInt32 UInt32 UInt32 19

整型,表示值介于 0 到 4294967295 之间的 32 位无符号整数。An integral type representing unsigned 32-bit integers with values between 0 and 4294967295.

UInt64 UInt64 UInt64 UInt64 20

整型,表示值介于 0 到 18446744073709551615 之间的 64 位无符号整数。An integral type representing unsigned 64-bit integers with values between 0 and 18446744073709551615.

VarNumeric VarNumeric VarNumeric VarNumeric 21

变长数值。A variable-length numeric value.

Xml Xml Xml Xml 25

XML 文档或片段的分析表示。A parsed representation of an XML document or fragment.

注解

参数类型是特定于.NET Framework 数据提供程序。The type of a parameter is specific to the .NET Framework data provider. 指定类型的值转换Parameter然后再将值传递到数据源的数据提供程序类型。Specifying the type converts the value of the Parameter to the data provider Type before passing the value to the data source. 如果未指定类型,ADO.NET 将推断数据提供程序类型的ParameterValue属性的Parameter对象。If the type is not specified, ADO.NET infers the data provider Type of the Parameter from the Value property of the Parameter object.

一般情况下还可以指定的类型Parameter通过设置DbType属性的Parameter对象。You can also generically specify the type of a Parameter by setting DbType property of a Parameter object.

如果字节数组大于 8,000 个字节,ADO.NET 不能正确推断类型。ADO.NET cannot correctly infer the type if a byte array is larger than 8,000 bytes. 显式指定DbType使用字节数组大于 8,000 个字节时。Explicitly specify the DbType when working with byte arrays larger than 8,000 bytes.

适用于

另请参阅