主题:与 .NET 类型之间的数据类型映射
与 .NET 类型之间的数据类型映射 (SQL Server)
.NET 有自己的数据类型定义,SQL Server 也有自身的数据类型定义,那么在.NET 程序开发中使用SQL Server 数据库中的表字段,需要对应数据类型的关系。
下表列出了 SQL Server 和 .NET 数据访问接口之间的数据类型映射:
.NET 数据类型 SQL Server 数据类型
binary varbinary
boolean bit
byte tinyint
byte[] varbinary
datetime datetime
decimal numeric
double float
guid uniqueidentifier
image image
int16 smallint
Uint16 uint16
int32 int
Uint32 uint32
int64 bigint
Uint64 uint64
SqlBinary varbinary
SqlBoolean bit
SqlByte tinyint
SqlDecimal¹ numeric
SqlDateTime datetime
SqlDouble float
SqlGuid uniqueidentifier
SqlInt16 smallint
SqlInt32 int
SqlInt64 bigint
SqlMoney money
SqlSingle real
SqlString nvarchar
single real
string nvarchar
信息来源[url]http://www.jisuanjixuexiao.com[/url]
.NET 有自己的数据类型定义,SQL Server 也有自身的数据类型定义,那么在.NET 程序开发中使用SQL Server 数据库中的表字段,需要对应数据类型的关系。
下表列出了 SQL Server 和 .NET 数据访问接口之间的数据类型映射:
.NET 数据类型 SQL Server 数据类型
binary varbinary
boolean bit
byte tinyint
byte[] varbinary
datetime datetime
decimal numeric
double float
guid uniqueidentifier
image image
int16 smallint
Uint16 uint16
int32 int
Uint32 uint32
int64 bigint
Uint64 uint64
SqlBinary varbinary
SqlBoolean bit
SqlByte tinyint
SqlDecimal¹ numeric
SqlDateTime datetime
SqlDouble float
SqlGuid uniqueidentifier
SqlInt16 smallint
SqlInt32 int
SqlInt64 bigint
SqlMoney money
SqlSingle real
SqlString nvarchar
single real
string nvarchar
信息来源[url]http://www.jisuanjixuexiao.com[/url]

您所在位置: