共用方式為


Managed 資料類型對應 (SQL Server Compact)

MicrosoftSQL Server Compact 4.0 無法完全支援所有 .NET 資料類型。使用 ADO.NET 存取資料時,SQL Server Compact 4.0 必須將不受支援的類型轉譯成受支援的類型。

資料類型對應

下表顯示 SQL Server Compact 4.0 與 .NET 資料提供者間的資料類型對應。

.NET 資料類型

SQL Server Compact 資料類型

binary

varbinary

boolean

bit

byte

tinyint

byte[]

varbinary

datetime

datetime

decimal

numeric

double

float

guid

uniqueidentifier

image

image

int16

smallint

int32

int

int64

bigint

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 4.0 最多僅支援 96 個位元的 SqlDecimal 資料類型。如果超出 96 個位元,SQL Server Compact 會擲出溢位例外狀況錯誤。

請參閱

參考

資料類型

其他資源

建立 Managed 應用程式 (SQL Server Compact)