与 .NET 类型之间的数据类型映射 (SQL Server Compact Edition)

Microsoft SQL Server 2005 Compact Edition (SQL Server Compact Edition) 不完全支持所有的 .NET 数据类型;当使用 ADO.NET 访问数据时,SQL Server Compact Edition 必须将不支持的类型转换为所支持的类型。

数据类型映射

下表列出了 SQL Server Compact Edition 和 .NET 数据访问接口之间的数据类型映射:

.NET 数据类型 SQL Server Compact Edition 数据类型

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

¹ SQL Server Compact Edition 支持的 SqlDecimal 数据类型只能达到 96 位。如果超过 96 位,SQL Server Compact Edition 将引发溢出异常错误。

请参阅

其他资源

数据类型映射 (SQL Server Compact Edition)

帮助和信息

获取 SQL Server Compact Edition 帮助