添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
曾经爱过的八宝粥  ·  numpy 2d ...·  2 周前    · 
慷慨的排球  ·  python - import ...·  10 月前    · 
一身肌肉的伤疤  ·  macos - Mac gcc ...·  1 年前    · 
乖乖的啄木鸟  ·  SpringBoot 整合 Kafka ...·  1 年前    · 

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft Edge More info about Internet Explorer and Microsoft Edge

SQL Server and the .NET Framework are based on different type systems. For example, the .NET Framework Decimal structure has a maximum scale of 28, whereas the SQL Server decimal and numeric data types have a maximum scale of 38. To maintain data integrity when reading and writing data, the SqlDataReader exposes SQL Server–specific typed accessor methods that return objects of System.Data.SqlTypes as well as accessor methods that return .NET Framework types. Both SQL Server types and .NET Framework types are also represented by enumerations in the DbType and SqlDbType classes, which you can use when specifying SqlParameter data types.

The following table shows the inferred .NET Framework type, the DbType and SqlDbType enumerations, and the accessor methods for the SqlDataReader .

SQL Server Database Engine type .NET Framework type SqlDbType enumeration SqlDataReader SqlTypes typed accessor DbType enumeration SqlDataReader DbType typed accessor

1 You cannot set the DbType property of a SqlParameter to SqlDbType.Date .
2 Use a specific typed accessor if you know the underlying type of the sql_variant .

SQL Server documentation

For more information about SQL Server data types, see Data types (Transact-SQL) .

See also

  • SQL Server Data Types and ADO.NET
  • SQL Server Binary and Large-Value Data
  • Data Type Mappings in ADO.NET
  • Configuring Parameters and Parameter Data Types
  • ADO.NET Overview
  •