• SqlServer与.NET的数据类型映射关系图



    关系表

    SQL Server 数据库引擎类型

    .NET Framework 类型

    SqlDbType 枚举

    SqlDataReader SqlTypes 类型化访问器

    DbType 枚举

    SqlDataReader DbType 类型化访问器

    bigint

    Int64

    BigInt

    GetSqlInt64

    Int64

    GetInt64

    binary

    Byte[]

    VarBinary

    GetSqlBinary

    Binary

    GetBytes

    bit

    Boolean

    Bit

    GetSqlBoolean

    Boolean

    GetBoolean

    char

    String

    Char[]

    Char

    GetSqlString

    AnsiStringFixedLength,

    String

    GetString

    GetChars

    date

    (仅适用 SQL Server 2008)

    DateTime

    Date

    GetSqlDateTime

    Date

    GetDateTime

    datetime

    DateTime

    DateTime

    GetSqlDateTime

    DateTime

    GetDateTime

    datetime2

    (仅适用 SQL Server 2008)

    DateTime2

    DateTime2

    GetSqlDateTime

    DateTime2

    GetDateTime

    datetimeoffset

    (仅适用 SQL Server 2008)

    DateTimeOffset

    DateTimeOffset

    none

    DateTimeOffset

    GetDateTimeOffset

    decimal

    Decimal

    Decimal

    GetSqlDecimal

    Decimal

    GetDecimal

    FILESTREAM 属性 (varbinary(max)

    Byte[]

    VarBinary

    GetSqlBytes

    Binary

    GetBytes

    float

    Double

    Float

    GetSqlDouble

    Double

    GetDouble

    image

    Byte[]

    Binary

    GetSqlBinary

    Binary

    GetBytes

    int

    Int32

    Int

    GetSqlInt32

    Int32

    GetInt32

    money

    Decimal

    Money

    GetSqlMoney

    Decimal

    GetDecimal

    nchar

    String

    Char[]

    NChar

    GetSqlString

    StringFixedLength

    GetString

    GetChars

    ntext

    String

    Char[]

    NText

    GetSqlString

    String

    GetString

    GetChars

    numeric

    Decimal

    Decimal

    GetSqlDecimal

    Decimal

    GetDecimal

    nvarchar

    String

    Char[]

    NVarChar

    GetSqlString

    String

    GetString

    GetChars

    real

    Single

    Real

    GetSqlSingle

    Single

    GetFloat

    rowversion

    Byte[]

    Timestamp

    GetSqlBinary

    Binary

    GetBytes

    smalldatetime

    DateTime

    DateTime

    GetSqlDateTime

    DateTime

    GetDateTime

    smallint

    Int16

    SmallInt

    GetSqlInt16

    Int16

    GetInt16

    smallmoney

    Decimal

    SmallMoney

    GetSqlDecimal

    Decimal

    GetDecimal

    sql_variant

    Object*

    Variant

    GetSqlValue *

    Object

    GetValue *

    text

    String

    Char[]

    Text

    GetSqlString

    String

    GetString

    GetChars

    time

    (仅适用 SQL Server 2008)

    TimeSpan

    Time

    none

    Time

    GetDateTime

    timestamp

    Byte[]

    Timestamp

    GetSqlBinary

    Binary

    GetBytes

    tinyint

    Byte

    TinyInt

    GetSqlByte

    Byte

    GetByte

    uniqueidentifier

    Guid

    UniqueIdentifier

    GetSqlGuid

    Guid

    GetGuid

    varbinary

    Byte[]

    VarBinary

    GetSqlBinary

    Binary

    GetBytes

    varchar

    String

    Char[]

    VarChar

    GetSqlString

    AnsiStringString

    GetString

    GetChars

    xml

    Xml

    Xml

    GetSqlXml

    Xml

    none


  • 相关阅读:
    【区块链整理】四、区块链数据结构
    【区块链整理】三、以太坊挖矿算法 ETHASH
    【区块链整理】二、比特币交易脚本
    【区块链整理】一、概念
    FISCO BCOS CRUD 功能和 CNS 合约命名服务杂记
    前台静态资源打包ios
    叹而立之年,忆往昔旧事
    基于Bootstrap table组件实现多层表头配置
    js或jQuery获取当前屏幕的各种高度
    echarts图表基础配置
  • 原文地址:https://www.cnblogs.com/hgmyz/p/12351897.html
Copyright © 2020-2023  润新知