SQL Server类型与dotnet类型的对应关系

SQL Server与.NET Framework数据类型映射
本文详细列举了SQL Server与.NET Framework之间的数据类型映射关系,并提供了每种类型的转换方法,如GetInt64()等。对于进行跨平台数据库开发的程序员来说,这是一份实用的对照表。

.NET Framework Data Provider for SQL Server

SQL Server type.NET Framework type.NET Framework typed accessorSqlType typed accessor
bigintInt64GetInt64()GetSqlInt64()
binaryByte[]GetBytes()GetSqlBinary()
bitBooleanGetBoolean()GetSqlBit()
charString

Char[]

GetString()

GetChars()

GetSqlString()
datetimeDateTimeGetDateTime()GetSqlDateTime()
decimalDecimalGetDecimal()GetSqlDecimal()
floatDoubleGetDouble()GetSqlDouble()
imageByte[]GetBytes()GetSqlBinary()
intInt32GetInt32()GetSqlInt32()
moneyDecimalGetDecimal()GetSqlMoney()
ncharString

Char[]

GetString()

GetChars()

GetSqlString()
ntextString

Char[]

GetString()

GetChars()

GetSqlString()
numericDecimalGetDecimal()GetSqlDecimal()
nvarcharString

Char[]

GetString()

GetChars()

GetSqlString()
realSingleGetFloat()GetSqlSingle()
smalldatetimeDateTimeGetDateTime()GetSqlDateTime()
smallintInt16GetInt16()GetSqlInt16()
smallmoneyDecimalGetDecimal()GetSqlDecimal()
sql_variantObject *GetValue() *GetSqlValue() *
textString

Char[]

GetString()

GetChars()

GetSqlString()
timestampByte[]GetBytes()GetSqlBinary()
tinyintByteGetByte()GetSqlByte()
uniqueidentifierGuidGetGuid()GetSqlGuid()
varbinaryByte[]GetBytes()GetSqlBinary()
varcharString

Char[]

GetString()

GetChars()

GetSqlString()

如想知道与其他数据库的对应关系。看MSDN: http://msdn2.microsoft.com/en-us/library/4e5xt97a(vs.71).aspx

转载于:https://www.cnblogs.com/luanwey/archive/2007/04/19/719146.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值