System.Data.SqlTypes 命名空間

提供 SQL Server 中原生資料型態的類別。 這些類別提供了比 .NET Framework 通用語言執行時(CLR)資料型別更安全、更快速的替代方案。 使用此命名空間中的類別有助於避免因精度損失而產生型別轉換錯誤。 由於其他資料型別會在幕後與 SqlTypes 互換,明確建立並使用此命名空間中的物件也能產生更快的程式碼。

類別

名稱 Description
SqlAlreadyFilledException

SqlAlreadyFilledException 類別並非設計成獨立元件,而是作為其他類別從中衍生標準功能的類別。

SqlBytes

代表一個可變的參考型態,包裹 a BufferStream

SqlChars

SqlChars 是一個可變的參考型態,會包裹陣 Char 列或實 SqlString 例。

SqlFileStream

公開以 FILESTREAM 資料行屬性儲存為位元組序列的 SQL Server 數據。

SqlNotFilledException

SqlNotFilledException 類別並非設計成獨立元件,而是作為其他類別從中衍生標準功能的類別。

SqlNullValueException

Value 結構的屬性 System.Data.SqlTypes 被設為 null 時拋出的例外。

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 類別並非設計成獨立元件,而是作為其他類別從中衍生標準功能的類別。

結構

名稱 Description
SqlBinary

表示要儲存或從資料庫擷取之二進位數據的可變長度數據流。

SqlBoolean

表示要儲存或從資料庫擷取的1或0整數值。

SqlByte

表示要儲存在資料庫或從資料庫擷取之 0 到 255 範圍內的 8 位無符號整數。

SqlDateTime

表示從 1753 年 1 月 1 日到 9999 年 12 月 31 日的日期和時間數據,精確度為 3.33 毫秒,以儲存或從資料庫擷取。 SqlDateTime 結構的底層資料結構與其對應的 .NET 類型 DateTime 不同,該類型可從 0001 年 1 月 1 日凌晨 12:00:00 到 19999 年 12 月 31 日下午 11:59:59 之間,精確度達 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,203,685,477.5807),精確度為要儲存或從資料庫擷取的貨幣單位十萬分之一。

SqlSingle

表示介於 -3.40E +38 到 3.40E +38 範圍內要儲存或從資料庫擷取的浮點數。

SqlString

表示要儲存或從資料庫擷取之字元的可變長度數據流。 SqlString 的底層資料結構與其對應的 .NET String 資料型不同。

介面

名稱 Description
INullable

所有 System.Data.SqlTypes 物件和結構都實作了這個 INullable 介面。

列舉

名稱 Description
SqlCompareOptions

指定 SqlString 結構的比較選項值。

StorageState

StorageState 列舉不是用來作為獨立元件,而是作為其他類別衍生標準功能的列舉。

備註

SqlTypes 中的每個資料型別在 SQL Server 都有其對應的資料型別,且底層資料表示方式相同。 其中許多 CLR 也有等效的資料型態。 然而,SqlDateTimeSqlDecimal 以及 SqlString 擁有不同的底層資料結構及其對應的 .NET Framework 資料型態。

下表將 SqlTypes 命名空間的成員映射到 Microsoft SQL Server 資料型別及 SqlDbType 枚舉的成員。

.NET Framework SqlTypes 原生 SQL Server .NET Framework SqlDbType
SqlBinary 二進位、影像、時間戳、變數 二進位、影像、時間戳、變體二進位
SqlBoolean bit 位元
SqlByte Tinyint TinyInt
SqlBytes 二進位、影像、時間戳、變數 二進位、影像、時間戳、變體二進位
SqlChars char,nchar,text,ntext,nvarchar,varchar Char、NChar、Text、Ntext、NVarChar、VarChar
SqlDateTime 約會時間,小約會時間 約會時間,小約會時間
SqlDecimal 數字、十進位 Decimal
SqlDouble float 浮動
SqlFileStream varbinary VarBinary
SqlGuid uniqueidentifier 唯一識別碼
SqlInt16 smallint SmallInt
SqlInt32 int int(整數)
SqlInt64 Bigint BigInt
SqlMoney 錢,小錢 錢,小錢
SqlSingle real 里耳
SqlString char,nchar,text,ntext,nvarchar,varchar Char、NChar、Text、Ntext、NVarChar、VarChar
SqlXml Xml Xml

另請參閱