SQL Server 数据类型和 ADO.NETSQL Server Data Types and ADO.NET

SQL Server 和 .NET Framework 基于不同的类型系统,这可导致潜在的数据丢失。SQL Server and the .NET Framework are based on different type systems, which can result in potential data loss. 为了保持数据的完整性,适用于 SQL Server 的 .NET Framework 数据提供程序 (System.Data.SqlClient) 提供了用于处理 SQL Server 数据的类型化访问器方法。To preserve data integrity, the .NET Framework Data Provider for SQL Server (System.Data.SqlClient) provides typed accessor methods for working with SQL Server data. 可以使用 SqlDbType 类中的枚举来指定 SqlParameter 数据类型。You can use the enumerations in the SqlDbType classes to specify SqlParameter data types.

有关详细信息和说明 SQL Server 和.NET Framework 数据类型之间的数据类型映射的表,请参阅SQL Server 数据类型映射For more information and a table that describes the data type mappings between SQL Server and .NET Framework data types, see SQL Server Data Type Mappings.

SQL Server 2008 引入了旨在满足业务需求的新数据类型,以用于处理日期和时间、结构化、半结构化和非结构化的数据。SQL Server 2008 introduces new data types that are designed to meet business needs to work with date and time, structured, semi-structured, and unstructured data. 这些文档位于 SQL Server 2008 联机丛书中。These are documented in SQL Server 2008 Books Online.

可在应用程序中使用的 SQL Server 数据类型取决于您正在使用的 SQL Server 版本。The SQL Server data types that are available for use in your application depends on the version of SQL Server that you are using. 有关更多信息,请参见下表中的相关版本的 SQL Server 联机丛书。For more information, see the relevant version of SQL Server Books Online in the following table.

SQL Server 联机丛书SQL Server Books Online

  1. 数据类型 (数据库引擎)Data Types (Database Engine)

本节内容In This Section

SqlTypes 和数据集SqlTypes and the DataSet
说明对 SqlTypesDataSet 的类型支持。Describes type support for SqlTypes in the DataSet.

处理 NULL 值Handling Null Values
演示如何使用空值和三值逻辑。Demonstrates how to work with null values and three-valued logic.

比较 GUID 和 uniqueidentifier 值Comparing GUID and uniqueidentifier Values
演示如何在 SQL Server 和 .NET Framework 中使用 GUID 和 uniqueidentifier 值。Demonstrates how to work with GUID and uniqueidentifier values in SQL Server and the .NET Framework.

日期和时间数据Date and Time Data
说明如何使用在 SQL Server 2008 中引入的新的日期和时间数据类型。Describes how to use the new date and time data types introduced in SQL Server 2008.

大型 UDTLarge UDTs
演示如何从在 SQL Server 2008 中引入的大值 UDT 检索数据。Demonstrates how to retrieve data from large value UDTs introduced in SQL Server 2008.

SQL Server 中的 XML 数据XML Data in SQL Server
说明如何使用从 SQL Server 中检索的 XML 数据。Describes how to work with XML data retrieved from SQL Server.

参考Reference

DataSet
描述 DataSet 类及其所有成员。Describes the DataSet class and all of its members.

System.Data.SqlTypes
说明 SqlTypes 命名空间及其所有成员。Describes the SqlTypes namespace and all of its members.

SqlDbType
说明 SqlDbType 枚举及其所有成员。Describes the SqlDbType enumeration and all of its members.

DbType
说明 DbType 枚举及其所有成员。Describes the DbType enumeration and all of its members.

请参阅See also