System.Data.SqlTypes 命名空間

提供 SQL Server 中原生資料類型的類別。 Provides classes for native data types in SQL Server. 相較於 .NET Framework Common Language Runtime (CLR) 所提供的資料型別,這些類別提供更安全、快速的替代方案。 These classes provide a safer, faster alternative to the data types provided by the .NET Framework common language runtime (CLR). 使用這個命名空間內的類別,有助於防止因精確度喪失所造成的型別轉換錯誤。 Using the classes in this namespace helps prevent type conversion errors caused by loss of precision. 因為其他資料類型是祕密地轉換至/自 SqlTypes ,所以明確建立和使用這個命名空間內的物件也會產生更快速的程式碼。 Because other data types are converted to and from SqlTypes behind the scenes, explicitly creating and using objects within this namespace also yields faster code.

類別

SqlAlreadyFilledException

SqlAlreadyFilledException 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The SqlAlreadyFilledException class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

SqlBytes

表示可變動的參考型別 (Reference Type),用來包裝 BufferStreamRepresents a mutable reference type that wraps either a Buffer or a Stream.

SqlChars

SqlChars 是一種可變動的參考型別 (Reference Type),它會包裝 Char 陣列或 SqlString 執行個體。SqlChars is a mutable reference type that wraps a Char array or a SqlString instance.

SqlFileStream

公開使用 FILESTREAM 資料行屬性儲存為位元組序列的 SQL Server 資料。Exposes SQL Server data that is stored with the FILESTREAM column attribute as a sequence of bytes.

SqlNotFilledException

SqlNotFilledException 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The SqlNotFilledException class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

SqlNullValueException

Value 結構的 System.Data.SqlTypes 屬性設定為 null 時,所擲回的例外狀況。The exception that is thrown when the Value property of a System.Data.SqlTypes structure is set to null.

SqlTruncateException

將某一個值設定成會截斷該值的 System.Data.SqlTypes 結構時所擲回的例外狀況。The exception that is thrown when you set a value into a System.Data.SqlTypes structure would truncate that value.

SqlTypeException

System.Data.SqlTypes 的基底例外狀況 (Exception) 類別。The base exception class for the System.Data.SqlTypes.

SqlTypesSchemaImporterExtensionHelper

SqlTypesSchemaImporterExtensionHelper 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The SqlTypesSchemaImporterExtensionHelper class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

SqlXml

表示存放在伺服器或從伺服器擷取的 XML 資料。Represents XML data stored in or retrieved from a server.

TypeBigIntSchemaImporterExtension

TypeBigIntSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeBigIntSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeBinarySchemaImporterExtension

TypeBinarySchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeBinarySchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeBitSchemaImporterExtension

TypeBitSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeBitSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeCharSchemaImporterExtension

TypeCharSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeCharSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeDateTimeSchemaImporterExtension

TypeDateTimeSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeDateTimeSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeDecimalSchemaImporterExtension

TypeDecimalSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeDecimalSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeFloatSchemaImporterExtension

TypeFloatSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeFloatSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeIntSchemaImporterExtension

TypeIntSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeIntSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeMoneySchemaImporterExtension

TypeMoneySchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeMoneySchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeNCharSchemaImporterExtension

TypeNCharSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeNCharSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeNTextSchemaImporterExtension

TypeNTextSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeNTextSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeNumericSchemaImporterExtension

TypeNumericSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeNumericSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeNVarCharSchemaImporterExtension

TypeNVarCharSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeNVarCharSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeRealSchemaImporterExtension

TypeRealSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeRealSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeSmallDateTimeSchemaImporterExtension

TypeSmallDateTimeSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeSmallDateTimeSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeSmallIntSchemaImporterExtension

TypeSmallIntSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeSmallIntSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeSmallMoneySchemaImporterExtension

TypeSmallMoneySchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeSmallMoneySchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeTextSchemaImporterExtension

TypeTextSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeTextSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeTinyIntSchemaImporterExtension

TypeTinyIntSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeTinyIntSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeUniqueIdentifierSchemaImporterExtension

TypeUniqueIdentifierSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeUniqueIdentifierSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeVarBinarySchemaImporterExtension

TypeVarBinarySchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeVarBinarySchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeVarCharSchemaImporterExtension

TypeVarCharSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeVarCharSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

TypeVarImageSchemaImporterExtension

TypeVarImageSchemaImporterExtension 類別並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能時所根據的類別。The TypeVarImageSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

結構

SqlBinary

表示要存放在資料庫或從資料庫中擷取之二進位資料的可變長度資料流。Represents a variable-length stream of binary data to be stored in or retrieved from a database.

SqlBoolean

表示要存放在資料庫或從資料庫擷取的 1 或 0 之整數值。Represents an integer value that is either 1 or 0 to be stored in or retrieved from a database.

SqlByte

表示要存放在資料庫或從資料庫擷取的 8 位元不帶正負號的整數 (Unsigned Integer),範圍介於 0 到 255 之間。Represents an 8-bit unsigned integer, in the range of 0 through 255, to be stored in or retrieved from a database.

SqlDateTime

表示要存放在資料庫或從資料庫擷取的日期與時間資料,值範圍從 1753 年 1 月 1 日至 9999 年 12 月 31 日,精確度為 3.33 毫秒。Represents the date and time data ranging in value from January 1, 1753 to December 31, 9999 to an accuracy of 3.33 milliseconds to be stored in or retrieved from a database. SqlDateTime 結構的底層資料結構與其對應的 .NET 型別 DateTime 不同,後者可以表示介於 0001/1/1 上午 12:00:00 到 9999/12/31 下午 11:59:59 之間的任何時間,精確度可達 100 奈秒。The SqlDateTime structure has a different underlying data structure from its corresponding .NET type, DateTime, which can represent any time between 12:00:00 AM 1/1/0001 and 11:59:59 PM 12/31/9999, to the accuracy of 100 nanoseconds. SqlDateTime 實際儲存的則是與 1900 年 1 月 1 日上午 00:00:00 的相對差異。SqlDateTime actually stores the relative difference to 00:00:00 AM 1/1/1900. 因此將 "00:00:00 AM 1/1/1900" 轉換成整數的結果將傳回 0。Therefore, a conversion from "00:00:00 AM 1/1/1900" to an integer will return 0.

SqlDecimal

表示具有固定整數位數和小數位數的數值,介於 - 10^38 +1 和 10^38 - 1 之間。Represents a numeric value between - 10^38 +1 and 10^38 - 1, with fixed precision and scale.

SqlDouble

表示 -1.79E +308 到 1.79E +308 範圍內的浮點數 (儲存於資料庫或從資料庫擷取)。Represents a floating-point number within the range of -1.79E +308 through 1.79E +308 to be stored in or retrieved from a database.

SqlGuid

表示要存放在資料庫或從資料庫擷取的 GUID。Represents a GUID to be stored in or retrieved from a database.

SqlInt16

表示要在資料庫中儲存或擷取的 16 位元帶正負號的整數。Represents a 16-bit signed integer to be stored in or retrieved from a database.

SqlInt32

表示要在資料庫中儲存或擷取的 32 位元帶正負號的整數 (Signed Integer)。Represents a 32-bit signed integer to be stored in or retrieved from a database.

SqlInt64

表示要在資料庫中儲存或擷取的 64 位元帶正負號的整數。Represents a 64-bit signed integer to be stored in or retrieved from a database.

SqlMoney

表示要存放在資料庫或從資料庫擷取的貨幣值,範圍從 -2 63 (或 -922,337,203,685,477.5808) 到 2 63 -1 (或 +922,337,203,685,477.5807),正確率為貨幣單位的萬分之一。Represents 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 currency unit to be stored in or retrieved from a database.

SqlSingle

表示 -3.40E +38 到 3.40E +38 範圍內的浮點數 (儲存於資料庫或從資料庫擷取)。Represents a floating point number within the range of -3.40E +38 through 3.40E +38 to be stored in or retrieved from a database.

SqlString

表示要儲存在資料庫或自資料庫擷取之字元的可變長度資料流。Represents a variable-length stream of characters to be stored in or retrieved from the database. SqlString 的底層資料結構與其對應的 .NET String 資料型別 不同。SqlString has a different underlying data structure from its corresponding .NET String data type.

介面

INullable

所有的 System.Data.SqlTypes 物件和結構都會實作 INullable 介面。All the System.Data.SqlTypes objects and structures implement the INullable interface.

列舉

SqlCompareOptions

指定 SqlString 結構的比較選項。Specifies the compare option values for a SqlString structure.

StorageState

StorageState 列舉型別 (Enumeration) 並非要做為獨立的元件使用,而是要做為其他類別衍生標準功能的列舉型別。The StorageState enumeration is not intended for use as a stand-alone component, but as an enumeration from which other classes derive standard functionality.

備註

SqlTypes 中的每個資料類型在 SQL Server 中都有相等的資料類型,且具有相同的基礎資料標記法。Each data type in SqlTypes has its equivalent data type in SQL Server, with the same underlying data representation. 其中許多都在 CLR 中也有相等的資料類型。Many of them also have equivalent data types in the CLR. 但是, SqlDateTimeSqlDecimalSqlString 有不同的基礎資料結構與其對應的 .NET Framework 資料類型。However, SqlDateTime , SqlDecimal , and SqlString have different underlying data structures with their corresponding .NET Framework data types.

下表對應 SqlTypes 命名空間的成員,以 Microsoft SQL Server 資料類型和列舉的成員 SqlDbTypeThe following table maps the members of the SqlTypes namespace to Microsoft SQL Server data types and to the members of the SqlDbType enumeration.

.NET Framework SqlTypes.NET Framework SqlTypes 原生 SQL ServerNative SQL Server .NET Framework SqlDbType.NET Framework SqlDbType
SqlBinary binary、image、timestamp、Varbinarybinary, image, timestamp, varbinary Binary、Image、TimeStamp、VarBinaryBinary, Image, TimeStamp, VarBinary
SqlBoolean bitbit 位元Bit
SqlByte tinyinttinyint TinyIntTinyInt
SqlBytes binary、image、timestamp、Varbinarybinary, image, timestamp, varbinary Binary、Image、TimeStamp、VarBinaryBinary, Image, TimeStamp, VarBinary
SqlChars char、Nchar、text、Ntext、Nvarchar、Varcharchar, nchar, text, ntext, nvarchar, varchar Char、NChar、Text、Ntext、NVarChar、VarCharChar, NChar, Text, Ntext, NVarChar, VarChar
SqlDateTime datetime, smalldatetimedatetime, smalldatetime DateTime、SmallDateTimeDateTime, SmallDateTime
SqlDecimal numeric、decimalnumeric, decimal DecimalDecimal
SqlDouble floatfloat 浮動Float
SqlFileStream varbinaryvarbinary VarBinaryVarBinary
SqlGuid uniqueidentifieruniqueidentifier UniqueIdentifierUniqueIdentifier
SqlInt16 smallintsmallint SmallIntSmallInt
SqlInt32 intint IntInt
SqlInt64 bigintbigint BigIntBigInt
SqlMoney money、smallmoneymoney, smallmoney Money、SmallMoneyMoney, SmallMoney
SqlSingle 實數real RealReal
SqlString char、Nchar、text、Ntext、Nvarchar、Varcharchar, nchar, text, ntext, nvarchar, varchar Char、NChar、Text、Ntext、NVarChar、VarCharChar, NChar, Text, Ntext, NVarChar, VarChar
SqlXml xmlxml XmlXml

另請參閱