SQL Server Data Types and ADO.NET
SQL Server and the .NET Framework are based on different type systems, which can result in potential data loss. 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. You can use the enumerations in the SqlDbType classes to specify SqlParameter data types.
For more information and a table that that describes the data type mappings between SQL Server and .NET Framework data types, see SQL Server Data Type Mappings (ADO.NET).
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. These are documented in SQL Server 2008 Books Online.
The SQL Server data types that are available for use in your application depends on the version of SQL Server that you are using. For more information, see the relevant version of SQL Server Books Online in the following table.
SQL Server 2000 |
SQL Server 2005 |
SQL Server 2008 |
SqlTypes and the DataSet (ADO.NET)
Describes type support for SqlTypes in the DataSet.Handling Null Values (ADO.NET)
Demonstrates how to work with null values and three-valued logic.Comparing GUID and uniqueidentifier Values (ADO.NET)
Demonstrates how to work with GUID and uniqueidentifier values in SQL Server and the .NET Framework.Date and Time Data in SQL Server 2008 (ADO.NET)
Describes how to use the new date and time data types introduced in SQL Server 2008.Large UDTs in SQL Server 2008 (ADO.NET)
Demonstrates how to retrieve data from large value UDTs introduced in SQL Server 2008.XML Data in SQL Server (ADO.NET)
Describes how to work with XML data retrieved from SQL Server.
DataSet
Describes the DataSet class and all of its members.System.Data.SqlTypes
Describes the SqlTypes namespace and all of its members.SqlDbType
Describes the SqlDbType enumeration and all of its members.DbType
Describes the DbType enumeration and all of its members.
SQL Server Data Type Mappings (ADO.NET)
Configuring Parameters and Parameter Data Types (ADO.NET)
Table-Valued Parameters in SQL Server 2008 (ADO.NET)