System.Data.SqlTypes Namespace

來源:互聯網
上載者:User
http://msdn2.microsoft.com/en-us/library/system.data.sqltypes.aspx

System.Data.SqlTypes Namespace 

The System.Data.SqlTypes namespace provides classes for native data types within SQL Server 2005. 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. 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.

Each data type in SqlTypes has its equivalent data type in SQL Server 2005, with the same underlying data representation. Many of them also have equivalent data types in the CLR. However, SqlDateTime, SqlDecimal, and SqlString have different underlying data structures with their corresponding .NET Framework data types.

The 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

Native SQL Server

.NET Framework SqlDbType

SqlBinary

binary, image, timestamp, varbinary

Binary, Image, TimeStamp, VarBinary

SqlBoolean

bit

Bit

SqlByte

tinyint

TinyInt

SqlDateTime

datetime, smalldatetime

DateTime, SmallDateTime

SqlDecimal

decimal

Decimal

SqlDouble

float

Float

SqlGuid

uniqueidentifier

UniqueIdentifier

SqlInt16

smallint

SmallInt

SqlInt32

int

Int

SqlInt64

bigint

BigInt

SqlMoney

money, smallmoney

Money, SmallMoney

SqlSingle

real

Real

SqlString

char, nchar, text, ntext, nvarchar, varchar

Char, NChar, Text, Ntext, NVarChar, VarChar

SqlXml

xml

Xml

Classes

  Class Description
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 Represents a mutable reference type that wraps either a Buffer or a Stream.
SqlChars SqlChars is a mutable reference type that wraps a Char array or a SqlString instance.
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 The exception that is thrown when the Value property of a System.Data.SqlTypes structure is set to null.
SqlTruncateException The exception that is thrown when you set a value into a System.Data.SqlTypes structure would truncate that value.
SqlTypeException The base exception class for the System.Data.SqlTypes.
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 Represents XML data stored in or retrieved from a server.
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 The TypeVarImageSchemaImporterExtension class is not intended for use as a stand-alone component, but as a class from which other classes derive standard functionality.

Interfaces

  Interface Description
INullable All the System.Data.SqlTypes objects and structures implement the INullable interface.

Structures

  Structure Description
SqlBinary Represents a variable-length stream of binary data to be stored in or retrieved from a database.
SqlBoolean Represents an integer value that is either 1 or 0 to be stored in or retrieved from a database.
SqlByte Represents an 8-bit unsigned integer, in the range of 0 through 255, to be stored in or retrieved from a database.
SqlDateTime 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. The SqlDateTime structure has a different underlying data structure from its corresponding .NET Framework 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 actually stores the relative difference to 00:00:00 AM 1/1/1900. Therefore, a conversion from "00:00:00 AM 1/1/1900" to an integer will return 0.
SqlDecimal Represents a numeric value between - 10^38 +1 and 10^38 - 1, with fixed precision and scale.
SqlDouble 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 Represents a GUID to be stored in or retrieved from a database.
SqlInt16 Represents a 16-bit signed integer to be stored in or retrieved from a database.
SqlInt32 Represents a 32-bit signed integer to be stored in or retrieved from a database.
SqlInt64 Represents a 64-bit signed integer to be stored in or retrieved from a database.
SqlMoney 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 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 has a different underlying data structure from its corresponding .NET Framework String data type. String always uses the default CultureInfo from the current thread, but SqlString contains its own locale Id and compare flags. The comparison result of two SqlString structures is independent of operating system and current thread locale.

Enumerations

  Enumeration Description
SqlCompareOptions Specifies the compare option values for a SqlString structure.
StorageState The StorageState enumeration is not intended for use as a stand-alone component, but as an enumeration from which other classes derive standard functionality.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.