System.Data.SqlTypes 命名空间

为SQL Server中的本机数据类型提供类。 这些类提供更安全、更快的替代.NET框架公共语言运行时(CLR)提供的数据类型。 使用此命名空间中的类有助于防止因精度丢失而导致的类型转换错误。 由于其他数据类型在后台转换到 SqlType 和从 SqlTypes 转换,因此显式创建和使用此命名空间中的对象也会产生更快的代码。

名称 说明
SqlAlreadyFilledException

SqlAlreadyFilledException 类不用作独立组件,而是用作其他类派生标准功能的类。

SqlBytes

表示包装或换BufferStream的可变引用类型。

SqlChars

SqlChars是包装数组或Char实例的可变引用类型SqlString

SqlFileStream

公开以 FILESTREAM 列属性作为字节序列存储的 SQL Server 数据。

SqlNotFilledException

SqlNotFilledException 类不用作独立组件,而是用作其他类派生标准功能的类。

SqlNullValueException

当结构的属性设置为 null 时 Value 引发的 System.Data.SqlTypes 异常。

SqlTruncateException

将值设置为结构时引发的 System.Data.SqlTypes 异常将截断该值。

SqlTypeException

的基异常类 System.Data.SqlTypes

SqlTypesSchemaImporterExtensionHelper

SqlTypesSchemaImporterExtensionHelper 类不用作独立组件,而是用作其他类派生标准功能的类。

SqlXml

表示存储在服务器中或从服务器检索的 XML 数据。

TypeBigIntSchemaImporterExtension

TypeBigIntSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeBinarySchemaImporterExtension

TypeBinarySchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeBitSchemaImporterExtension

TypeBitSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeCharSchemaImporterExtension

TypeCharSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeDateTimeSchemaImporterExtension

TypeDateTimeSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeDecimalSchemaImporterExtension

TypeDecimalSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeFloatSchemaImporterExtension

TypeFloatSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeIntSchemaImporterExtension

TypeIntSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeMoneySchemaImporterExtension

TypeMoneySchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeNCharSchemaImporterExtension

TypeNCharSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeNTextSchemaImporterExtension

TypeNTextSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeNumericSchemaImporterExtension

TypeNumericSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeNVarCharSchemaImporterExtension

TypeNVarCharSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeRealSchemaImporterExtension

TypeRealSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeSmallDateTimeSchemaImporterExtension

TypeSmallDateTimeSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeSmallIntSchemaImporterExtension

TypeSmallIntSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeSmallMoneySchemaImporterExtension

TypeSmallMoneySchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeTextSchemaImporterExtension

TypeTextSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeTinyIntSchemaImporterExtension

TypeTinyIntSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeUniqueIdentifierSchemaImporterExtension

TypeUniqueIdentifierSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeVarBinarySchemaImporterExtension

TypeVarBinarySchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeVarCharSchemaImporterExtension

TypeVarCharSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

TypeVarImageSchemaImporterExtension

TypeVarImageSchemaImporterExtension 类不用作独立组件,而是用作其他类派生标准功能的类。

结构

名称 说明
SqlBinary

表示要存储在数据库中或从数据库中检索的二进制数据的可变长度流。

SqlBoolean

表示要存储在数据库中或从数据库中检索的 1 或 0 的整数值。

SqlByte

表示要存储在数据库中或从数据库中检索到的 0 到 255 范围内的 8 位无符号整数。

SqlDateTime

表示从 1753 年 1 月 1 日到 9999 年 12 月 31 日的值的日期和时间数据,精度为 3.33 毫秒,以存储在数据库中或从数据库中检索。 SqlDateTime 结构具有与其相应.NET类型不同的基础数据结构, DateTime,它可以表示 12:00:00 AM 1/1/0001 和 11:59:59 PM 12/31/9999 之间的任意时间,精度为 100 纳秒。 SqlDateTime 实际存储与 1900 年 1 月 1 日上午 00:00:00 的相对差异。 因此,从“00:00:00 AM 1/1/1900”转换为整数将返回 0。

SqlDecimal

表示介于 - 10^38 +1 和 10^38 - 1 之间的数值,精度和小数位数固定。

SqlDouble

表示要存储在数据库中或从数据库中检索到的 -1.79E +308 到 1.79E +308 范围内的浮点数。

SqlGuid

表示要存储在数据库中或从数据库中检索的 GUID。

SqlInt16

表示要存储在数据库中或从数据库中检索的 16 位有符号整数。

SqlInt32

表示要存储在数据库中或从数据库中检索的 32 位有符号整数。

SqlInt64

表示要存储在数据库中或从数据库中检索的 64 位有符号整数。

SqlMoney

表示从 -2 63(或 -922,337,203,685,477.5808)到 2 63 -1(或 -922,337,685,477.5808)的货币值 或 +922,337,203,685,477.5807),准确性为要存储在数据库中或从数据库中检索的货币单位的万分之一。

SqlSingle

表示要存储在数据库中或从数据库中检索到的 -3.40E +38 到 3.40E +38 范围内的浮点数。

SqlString

表示要存储在数据库中或从数据库中检索的字符的可变长度流。 SqlString具有与其相应的 .NET String 数据类型不同的基础数据结构。

接口

名称 说明
INullable

System.Data.SqlTypes所有对象和结构都实现INullable接口。

枚举

名称 说明
SqlCompareOptions

指定 SqlString 结构的比较选项值。

StorageState

StorageState 枚举不用作独立组件,而是用作其他类派生标准功能的枚举。

注解

SqlTypes中的每个数据类型在 SQL Server 中具有等效数据类型,其基础数据表示形式相同。 其中许多在 CLR 中也具有等效的数据类型。 但是,SqlDateTimeSqlDecimalSqlString 具有不同的基础数据结构及其相应的.NET框架数据类型。

下表将 SqlTypes 命名空间的成员映射到Microsoft SQL Server数据类型和 SqlDbType 枚举的成员。

.NET Framework SqlTypes 本机SQL Server .NET Framework SqlDbType
SqlBinary binary, image, timestamp, varbinary Binary、Image、TimeStamp、VarBinary
SqlBoolean bit 比特
SqlByte tinyint TinyInt
SqlBytes binary, image, timestamp, varbinary Binary、Image、TimeStamp、VarBinary
SqlChars char, nchar, text, ntext, nvarchar, varchar Char、NChar、Text、Ntext、NVarChar、VarChar
SqlDateTime datetime、smalldatetime DateTime、SmallDateTime
SqlDecimal numeric、decimal 十进制
SqlDouble float 漂浮
SqlFileStream varbinary VarBinary
SqlGuid uniqueidentifier UniqueIdentifier
SqlInt16 smallint SmallInt
SqlInt32 int int (整数)
SqlInt64 bigint BigInt
SqlMoney money, smallmoney Money、SmallMoney
SqlSingle real 雷亚尔
SqlString char, nchar, text, ntext, nvarchar, varchar Char、NChar、Text、Ntext、NVarChar、VarChar
SqlXml xml Xml

另请参阅