ADO数据类型在各数据库及.net框架中的对应值关系
一、 对于做有数据库的网站来说:如果你用的是sql数据库,那就用sqlClient数据连接方式,不要用oleDb方式,易出错。
二、Access的字段类型问题,Access的字段类型与OleDbType的类型很难一一吻合,
那么取相似的即可,比如access中的备注型,那么就在OleDbType中用
LongVarchar即可。比如:
OleDbParameter para=new OleDbParameter("@proFun",OleDbType.LongVarChar);
para.Value=myaddPro.proFun;//一个产品对象的功能描叙参数,备注型
cmd.Parameters.Add(para);
三、System.Data.OleDb.OleDbType.LongVarBinary对应SQL数据库的类型为image.
=====================================================================================
ADO数据类型在各数据库及.net框架中的对应值关系
下面就是ADO数据类型在 Visual Basic, Access, SQL Server, Oracle, 和 .NET Framework之间的转换关系对照表。
ADODataTypeEnum | ADODataTypeEnumValue | .NETFramework | SQLServer | Size | Access | Oracle | VisualBasic6.0 |
adBigInt | 20 | bigint 9 | 8 |
|
| Variant | |
adBinary | 128 | binary | 50 |
| Raw 7 | Variant | |
adBoolean | 11 | bit |
| |
| Boolean | |
adBSTR | 8 | String |
|
|
|
|
|
adChapter | 136 | (DataReader) |
|
|
|
|
|
adChar | 129 | char | X |
| Char | String | |
adCurrency | 6 | Decimal | money | 8 | |
| Currency |
adDate | 7 | DateTime |
|
| |
| Date |
adDBDate | 133 | DateTime |
|
|
|
|
|
adDBFileTime | 137 | DBFileTime 11 |
|
|
|
|
|
adDBTime | 134 | DateTime |
|
|
|
|
|
adDBTimeStamp | 135 | datetime | 8 | | Date | Date | |
adDecimal | 14 | Decimal |
|
|
| Decimal 7 | Variant 6 |
adDouble | 5 | float | | | Float | Double | |
adEmpty | 0 | Empty 11 |
|
|
|
|
|
adError | 10 | External-Exception |
|
|
|
|
|
adFileTime | 64 | DateTime |
|
|
|
|
|
adGUID | 72 | uniqueidentifier5 | 16 |
| Variant | ||
adIDispatch | 9 | Object |
|
|
|
|
|
adInteger | 3 | identity 4 | 4 | | Int 7 | Long | |
adIUnknown | 13 | Object |
|
|
|
|
|
adLongVarBinary | 205 | image | 2147483647 | | Variant | ||
adLongVarChar | 201 | text | 2147483647 | String | |||
adLongVarWChar | 203 | String | ntext 5 | 1073741823 | NClob 8 | String | |
adNumeric | 131 | decimal | 9 | | Decimal | Variant 6 | |
adPropVariant | 138 | Object |
|
|
|
|
|
adSingle | 4 | real | 4 | |
| Single | |
adSmallInt | 2 | smallInt | 2 | |
| Integer | |
adTinyInt | 16 | Byte |
|
|
|
|
|
adUnsignedBigInt | 21 | UInt64 |
|
|
|
|
|
adUnsignedInt | 19 | UInt32 |
|
|
|
|
|
adUnsignedSmallInt | 18 | UInt16 |
|
|
|
|
|
adUnsignedTinyInt | 17 | tinyInt | 1 | |
| Byte | |
adUserDefined | 132 |
|
|
|
|
|
|
adVarBinary | 204 | varbinary | 50 | |
| Variant | |
adVarChar | 200 | varchar | X | VarChar | String | ||
adVariant | 12 | sql_variant 9 | 8016 |
| VarChar2 | Variant | |
adVarNumeric | 139 | OleDbType.VarNumeric 11 |
|
|
|
|
|
adVarWChar | 202 | nvarchar 5 | X | | NVarChar2 | String | |
adWChar | 130 | nchar 5 | X |
|
| String |
1 - ODBC Driver (3.51.171300): Microsoft Access Driver (*.mdb), Access 97 (3.5 format)
2 - OLE DB Provider: Microsoft.Jet.OLEDB.3.51, Access 97 (3.5 format)
3 - OLE DB Provider: Microsoft.Jet.OLEDB.4.0 , Access 2000 (4.0 format)
4 - OLE DB Provider: SQLOLEDB, SQL Server 6.5
5 - OLE DB Provider: SQLOLEDB, SQL Server 7.0 +
6 - The VB Decimal data type can only be used within a Variant, that is, you cannot declare
a VB variable to be of type Decimal.
7 - Oracle 8.0.x Note: DECIMAL and INT are synonyms for NUMBER and NUMBER(10) respectively.
8 - Oracle 8.1.x
9 - OLE DB Provider: SQLOLEDB, SQL Server 2000 +
10 - SQL Server .NET Data Provider (via System.Data.SqlTypes)
11 - OLE DB .NET Data Provider (via System.Data.OleDb)