DAL与数据库类型的对应关系

MSSQL Server类型 DbType类型 C#类型   MySql类型 DbType类型 C#类型
bit Boolean bool   bit(1) Boolean bool
tinyint Byte byte   bit UInt64 ulong
smallint Int16 short   tinyint(1) Boolean bool
int Int32 int   tinyint Byte byte
bigint Int64 long   smallint Short short
real Single float   int Int32 int
float Double double   bigint Int64 long
money Decimal decimal   decimal Currency decimal
numeric Decimal decimal   double Double double
decimal Currency decimal   float Single float
smallmoney Currency decimal   char(1) AnsiStringFixedLength char
date Date DateTime   char AnsiStringFixedLength string
time Time TimeSpan   varchar AnsiString string
datetime DateTime DateTime   date DateTime DateTime
smalldatetime DateTime DateTime   datetime DateTime DateTime
datetime2 DateTime DateTime   time Time TimeSpan
datetimeoffset DateTimeOffset DateTime   timestamp DateTime DateTime
timestamp Binary byte[]   year Int16 short
char(1) AnsiStringFixedLength char   binary Binary byte[]
char AnsiStringFixedLength string   text String string
varchar AnsiString string        
nchar StringFixedLength char        
nvarchar String string        
text String string        
ntext String string        
image Binary byte[]        
binary Binary byte[]        
uniqueidentifier Guid Guid        
image Binary byte[]        
sql_variant Object object        
xml Xml string        
posted @ 2015-07-14 17:31  streetpasser  阅读(408)  评论(0编辑  收藏  举报