Udostępnij za pośrednictwem


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

Data Types

Data Types (Database Engine)

Data Types (Database Engine)

In This Section

Reference

  • 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.

See Also

Concepts

SQL Server Data Type Mappings (ADO.NET)

Configuring Parameters and Parameter Data Types (ADO.NET)

Table-Valued Parameters in SQL Server 2008 (ADO.NET)

Other Resources

Binary and Large-Value Data (ADO.NET)

ADO.NET Managed Providers and DataSet Developer Center