System.Data.DbType与各类数据库的数据类型的映射关系
有如下类型的映射对照:
- System.Data.SqlClient.SqlDbType
- System.Data.OleDb.OleDbType
- System.Data.Odbc.OdbcType
- System.Data.OracleClient.OracleType
- Oracle.ManagedDataAccess.ClientOracleDbType
格式:
DbType.枚举名(枚举值) = DbType.枚举名(枚举值)
1、与 System.Data.SqlClient.SqlDbType转换
System.Data.SqlClient.SqlDbType.BigInt(0) = System.Data.DbType.Int64(12)
System.Data.SqlClient.SqlDbType.Binary(1) = System.Data.DbType.Binary(1)
System.Data.SqlClient.SqlDbType.Bit(2) = System.Data.DbType.Boolean(3)
System.Data.SqlClient.SqlDbType.Char(3) = System.Data.DbType.AnsiStringFixedLength(22)
System.Data.SqlClient.SqlDbType.DateTime(4) = System.Data.DbType.DateTime(6)
System.Data.SqlClient.SqlDbType.Decimal(5) = System.Data.DbType.Decimal(7)
System.Data.SqlClient.SqlDbType.Float(6) = System.Data.DbType.Double(8)
System.Data.SqlClient.SqlDbType.Image(7) = System.Data.DbType.Binary(1)
System.Data.SqlClient.SqlDbType.Int(8) = System.Data.DbType.Int32(11)
System.Data.SqlClient.SqlDbType.Money(9) = System.Data.DbType.Currency(4)
System.Data.SqlClient.SqlDbType.NChar(10) = System.Data.DbType.StringFixedLength(23)
System.Data.SqlClient.SqlDbType.NText(11) = System.Data.DbType.String(16)
System.Data.SqlClient.SqlDbType.NVarChar(12) = System.Data.DbType.String(16)
System.Data.SqlClient.SqlDbType.Real(13) = System.Data.DbType.Single(15)
System.Data.SqlClient.SqlDbType.UniqueIdentifier(14) = System.Data.DbType.Guid(9)
System.Data.SqlClient.SqlDbType.SmallDateTime(15) = System.Data.DbType.DateTime(6)
System.Data.SqlClient.SqlDbType.SmallInt(16) = System.Data.DbType.Int16(10)
System.Data.SqlClient.SqlDbType.SmallMoney(17) = System.Data.DbType.Currency(4)
System.Data.SqlClient.SqlDbType.Text(18) = System.Data.DbType.AnsiString(0)
System.Data.SqlClient.SqlDbType.Timestamp(19) = System.Data.DbType.Binary(1)
System.Data.SqlClient.SqlDbType.TinyInt(20) = System.Data.DbType.Byte(2)
System.Data.SqlClient.SqlDbType.VarBinary(21) = System.Data.DbType.Binary(1)
System.Data.SqlClient.SqlDbType.VarChar(22) = System.Data.DbType.AnsiString(0)
System.Data.SqlClient.SqlDbType.Variant(23) = System.Data.DbType.Object(13)
System.Data.SqlClient.SqlDbType.Xml(25) = System.Data.DbType.Xml(25)
System.Data.SqlClient.SqlDbType.Udt(29) = System.Data.DbType.Object(13)
System.Data.SqlClient.SqlDbType.Structured(30) = System.Data.DbType.Object(13)
System.Data.SqlClient.SqlDbType.Date(31) = System.Data.DbType.Date(5)
System.Data.SqlClient.SqlDbType.Time(32) = System.Data.DbType.Time(17)
System.Data.SqlClient.SqlDbType.DateTime2(33) = System.Data.DbType.DateTime2(26)
System.Data.SqlClient.SqlDbType.DateTimeOffset(34) = System.Data.DbType.DateTimeOffset(27)
2、与 System.Data.OleDb.OleDbType转换
System.Data.OleDb.OleDbType.Empty(0) = System.Data.DbType.Object(13)
System.Data.OleDb.OleDbType.SmallInt(2) = System.Data.DbType.Int16(10)
System.Data.OleDb.OleDbType.Integer(3) = System.Data.DbType.Int32(11)
System.Data.OleDb.OleDbType.Single(4) = System.Data.DbType.Single(15)
System.Data.OleDb.OleDbType.Double(5) = System.Data.DbType.Double(8)
System.Data.OleDb.OleDbType.Currency(6) = System.Data.DbType.Currency(4)
System.Data.OleDb.OleDbType.Date(7) = System.Data.DbType.DateTime(6)
System.Data.OleDb.OleDbType.BSTR(8) = System.Data.DbType.String(16)
System.Data.OleDb.OleDbType.IDispatch(9) = System.Data.DbType.Object(13)
System.Data.OleDb.OleDbType.Error(10) = System.Data.DbType.Int32(11)
System.Data.OleDb.OleDbType.Boolean(11) = System.Data.DbType.Boolean(3)
System.Data.OleDb.OleDbType.Variant(12) = System.Data.DbType.Object(13)
System.Data.OleDb.OleDbType.IUnknown(13) = System.Data.DbType.Object(13)
System.Data.OleDb.OleDbType.Decimal(14) = System.Data.DbType.Decimal(7)
System.Data.OleDb.OleDbType.TinyInt(16) = System.Data.DbType.SByte(14)
System.Data.OleDb.OleDbType.UnsignedTinyInt(17) = System.Data.DbType.Byte(2)
System.Data.OleDb.OleDbType.UnsignedSmallInt(18) = System.Data.DbType.UInt16(18)
System.Data.OleDb.OleDbType.UnsignedInt(19) = System.Data.DbType.UInt32(19)
System.Data.OleDb.OleDbType.BigInt(20) = System.Data.DbType.Int64(12)
System.Data.OleDb.OleDbType.UnsignedBigInt(21) = System.Data.DbType.UInt64(20)
System.Data.OleDb.OleDbType.Filetime(64) = System.Data.DbType.DateTime(6)
System.Data.OleDb.OleDbType.Guid(72) = System.Data.DbType.Guid(9)
System.Data.OleDb.OleDbType.Binary(128) = System.Data.DbType.Binary(1)
System.Data.OleDb.OleDbType.Char(129) = System.Data.DbType.AnsiStringFixedLength(22)
System.Data.OleDb.OleDbType.WChar(130) = System.Data.DbType.StringFixedLength(23)
System.Data.OleDb.OleDbType.Numeric(131) = System.Data.DbType.Decimal(7)
System.Data.OleDb.OleDbType.DBDate(133) = System.Data.DbType.Date(5)
System.Data.OleDb.OleDbType.DBTime(134) = System.Data.DbType.Time(17)
System.Data.OleDb.OleDbType.DBTimeStamp(135) = System.Data.DbType.DateTime(6)
System.Data.OleDb.OleDbType.PropVariant(138) = System.Data.DbType.Object(13)
System.Data.OleDb.OleDbType.VarNumeric(139) = System.Data.DbType.VarNumeric(21)
System.Data.OleDb.OleDbType.VarChar(200) = System.Data.DbType.AnsiString(0)
System.Data.OleDb.OleDbType.LongVarChar(201) = System.Data.DbType.AnsiString(0)
System.Data.OleDb.OleDbType.VarWChar(202) = System.Data.DbType.String(16)
System.Data.OleDb.OleDbType.LongVarWChar(203) = System.Data.DbType.String(16)
System.Data.OleDb.OleDbType.VarBinary(204) = System.Data.DbType.Binary(1)
System.Data.OleDb.OleDbType.LongVarBinary(205) = System.Data.DbType.Binary(1)
3、与System.Data.Odbc.OdbcType转换
System.Data.Odbc.OdbcType.BigInt(1) = System.Data.DbType.Int64(12)
System.Data.Odbc.OdbcType.Binary(2) = System.Data.DbType.Binary(1)
System.Data.Odbc.OdbcType.Bit(3) = System.Data.DbType.Boolean(3)
System.Data.Odbc.OdbcType.Char(4) = System.Data.DbType.AnsiStringFixedLength(22)
System.Data.Odbc.OdbcType.DateTime(5) = System.Data.DbType.DateTime(6)
System.Data.Odbc.OdbcType.Decimal(6) = System.Data.DbType.Decimal(7)
System.Data.Odbc.OdbcType.Numeric(7) = System.Data.DbType.Decimal(7)
System.Data.Odbc.OdbcType.Double(8) = System.Data.DbType.Double(8)
System.Data.Odbc.OdbcType.Image(9) = System.Data.DbType.Binary(1)
System.Data.Odbc.OdbcType.Int(10) = System.Data.DbType.Int32(11)
System.Data.Odbc.OdbcType.NChar(11) = System.Data.DbType.StringFixedLength(23)
System.Data.Odbc.OdbcType.NText(12) = System.Data.DbType.String(16)
System.Data.Odbc.OdbcType.NVarChar(13) = System.Data.DbType.String(16)
System.Data.Odbc.OdbcType.Real(14) = System.Data.DbType.Single(15)
System.Data.Odbc.OdbcType.UniqueIdentifier(15) = System.Data.DbType.Guid(9)
System.Data.Odbc.OdbcType.SmallDateTime(16) = System.Data.DbType.DateTime(6)
System.Data.Odbc.OdbcType.SmallInt(17) = System.Data.DbType.Int16(10)
System.Data.Odbc.OdbcType.Text(18) = System.Data.DbType.AnsiString(0)
System.Data.Odbc.OdbcType.Timestamp(19) = System.Data.DbType.Binary(1)
System.Data.Odbc.OdbcType.TinyInt(20) = System.Data.DbType.Byte(2)
System.Data.Odbc.OdbcType.VarBinary(21) = System.Data.DbType.Binary(1)
System.Data.Odbc.OdbcType.VarChar(22) = System.Data.DbType.AnsiString(0)
System.Data.Odbc.OdbcType.Date(23) = System.Data.DbType.Date(5)
System.Data.Odbc.OdbcType.Time(24) = System.Data.DbType.Time(17)
4、与System.Data.OracleClient.OracleType转换
System.Data.OracleClient.OracleType.BFile(1) = System.Data.DbType.Binary(1)
System.Data.OracleClient.OracleType.Blob(2) = System.Data.DbType.Binary(1)
System.Data.OracleClient.OracleType.Char(3) = System.Data.DbType.AnsiStringFixedLength(22)
System.Data.OracleClient.OracleType.Clob(4) = System.Data.DbType.AnsiString(0)
System.Data.OracleClient.OracleType.Cursor(5) = System.Data.DbType.Object(13)
System.Data.OracleClient.OracleType.DateTime(6) = System.Data.DbType.DateTime(6)
System.Data.OracleClient.OracleType.IntervalDayToSecond(7) = System.Data.DbType.Object(13)
System.Data.OracleClient.OracleType.IntervalYearToMonth(8) = System.Data.DbType.Int32(11)
System.Data.OracleClient.OracleType.LongRaw(9) = System.Data.DbType.Binary(1)
System.Data.OracleClient.OracleType.LongVarChar(10) = System.Data.DbType.AnsiString(0)
System.Data.OracleClient.OracleType.NChar(11) = System.Data.DbType.StringFixedLength(23)
System.Data.OracleClient.OracleType.NClob(12) = System.Data.DbType.String(16)
System.Data.OracleClient.OracleType.Number(13) = System.Data.DbType.VarNumeric(21)
System.Data.OracleClient.OracleType.NVarChar(14) = System.Data.DbType.String(16)
System.Data.OracleClient.OracleType.Raw(15) = System.Data.DbType.Binary(1)
System.Data.OracleClient.OracleType.RowId(16) = System.Data.DbType.AnsiString(0)
System.Data.OracleClient.OracleType.Timestamp(18) = System.Data.DbType.DateTime(6)
System.Data.OracleClient.OracleType.TimestampLocal(19) = System.Data.DbType.DateTime(6)
System.Data.OracleClient.OracleType.TimestampWithTZ(20) = System.Data.DbType.DateTime(6)
System.Data.OracleClient.OracleType.VarChar(22) = System.Data.DbType.AnsiString(0)
System.Data.OracleClient.OracleType.Byte(23) = System.Data.DbType.Byte(2)
System.Data.OracleClient.OracleType.UInt16(24) = System.Data.DbType.UInt16(18)
System.Data.OracleClient.OracleType.UInt32(25) = System.Data.DbType.UInt32(19)
System.Data.OracleClient.OracleType.SByte(26) = System.Data.DbType.SByte(14)
System.Data.OracleClient.OracleType.Int16(27) = System.Data.DbType.Int16(10)
System.Data.OracleClient.OracleType.Int32(28) = System.Data.DbType.Int32(11)
System.Data.OracleClient.OracleType.Float(29) = System.Data.DbType.Single(15)
System.Data.OracleClient.OracleType.Double(30) = System.Data.DbType.Double(8)
5、与Oracle.ManagedDataAccess.ClientOracleDbType转换
Oracle.ManagedDataAccess.ClientOracleDbType.BFile = System.Data.DbType.Binary(1)
Oracle.ManagedDataAccess.ClientOracleDbType.Blob = 102,
Oracle.ManagedDataAccess.ClientOracleDbType.Byte = 103,
Oracle.ManagedDataAccess.ClientOracleDbType.Char = 104,
Oracle.ManagedDataAccess.ClientOracleDbType.Clob = 105,
Oracle.ManagedDataAccess.ClientOracleDbType.Date = 106,
Oracle.ManagedDataAccess.ClientOracleDbType.Decimal = 107,
Oracle.ManagedDataAccess.ClientOracleDbType.Double = 108,
Oracle.ManagedDataAccess.ClientOracleDbType.Long = 109,
Oracle.ManagedDataAccess.ClientOracleDbType.LongRaw = 110,
Oracle.ManagedDataAccess.ClientOracleDbType.Int16 = 111,
Oracle.ManagedDataAccess.ClientOracleDbType.Int32 = 112,
Oracle.ManagedDataAccess.ClientOracleDbType.Int64 = 113,
Oracle.ManagedDataAccess.ClientOracleDbType.IntervalDS = 114,
Oracle.ManagedDataAccess.ClientOracleDbType.IntervalYM = 115,
Oracle.ManagedDataAccess.ClientOracleDbType.NClob = 116,
Oracle.ManagedDataAccess.ClientOracleDbType.NChar = 117,
Oracle.ManagedDataAccess.ClientOracleDbType.NVarchar2 = 119,
Oracle.ManagedDataAccess.ClientOracleDbType.Raw = 120,
Oracle.ManagedDataAccess.ClientOracleDbType.RefCursor = 121,
Oracle.ManagedDataAccess.ClientOracleDbType.Single = 122,
Oracle.ManagedDataAccess.ClientOracleDbType.TimeStamp = 123,
Oracle.ManagedDataAccess.ClientOracleDbType.TimeStampLTZ = 124,
Oracle.ManagedDataAccess.ClientOracleDbType.TimeStampTZ = 125,
Oracle.ManagedDataAccess.ClientOracleDbType.Varchar2 = 126,
Oracle.ManagedDataAccess.ClientOracleDbType.XmlType = 127,
Oracle.ManagedDataAccess.ClientOracleDbType.BinaryDouble = 132,
Oracle.ManagedDataAccess.ClientOracleDbType.BinaryFloat = 133,
Oracle.ManagedDataAccess.ClientOracleDbType.Boolean = 134,
System.Data.DbType与各类数据库的数据类型的映射关系的更多相关文章
- System.Data.DbType和数据库映射关系
有如下类型的映射对照: System.Data.SqlClient.SqlDbType System.Data.OleDb.OleDbType System.Data.Odbc.OdbcType S ...
- System.Data.Dbtype转换为System.Data.SqlDbType
最近在做一些OM Mapping的准备工作,新学了一招. 如果要将System.Data.Dbtype转换为System.Data.SqlDbType,以前以为要写Switch Case语句.其实有很 ...
- System.Data.DbType 与其它DbType的映射关系
System.Data.DbType 与其它DbType的映射关系 有如下类型的映射对照: System.Data.SqlClient.SqlDbType System.Data.OleDb.OleD ...
- System.Data.DbType映射关系
有如下类型的映射对照: System.Data.SqlClient.SqlDbType System.Data.OleDb.OleDbType System.Data.Odbc.OdbcType S ...
- 数据库还原,System.Data.SqlClient.SqlError: 因为数据库正在使用,所以无法获得对数据库的独占访问权。 (Microsoft.SqlServer.SmoExtended)
数据库还原问题: System.Data.SqlClient.SqlError: 因为数据库正在使用,所以无法获得对数据库的独占访问权. (Microsoft.SqlServer.SmoExtende ...
- PostgreSQL、SQL Server数据库中的数据类型的映射关系
PostgreSQL 8.1 轰动发布,我也打算将原来使用 SQL Server 的一些应用迁移到 PostgreSQL 上,首先需要迁移的是表,那么这就必须要先搞清楚这两个数据库中的数据类型的映射关 ...
- Hibernate基于注解方式配置来实现实体和数据库之间存在某种映射关系
实体和数据库之间存在某种映射关系,hibernate根据这种映射关系完成数据的存取.在程序中这种映射关系由映射文件(*.hbm.xml)或者java注解(@)定义. 本文以java注解的形式总结映射关 ...
- System.Data.OleDb操作access数据库类,【bubuko.com】
access数据库在应用了System.Data.OleDb后操作会很方便,这是一个常用的数据库操作类,其中两个方法,一个是返回datatable的,一个是执行sql语句返回影响记录的(一般是inse ...
- JNI/NDK开发指南(三)——JNI数据类型及与Java数据类型的映射关系
转载请注明出处:http://blog.csdn.net/xyang81/article/details/42047899 当我们在调用一个Java native方法的时候.方法中的參数是怎样传递给C ...
随机推荐
- 每天一道剑指offer-二叉树的下一个结点1
题目 每天一道剑指offer-二叉树的下一个结点https://www.nowcoder.com/practice/ef068f602dde4d28aab2b210e859150a?tpId=13&a ...
- Unity Shader之使用Cubemap实现反射效果
1.Cubemap是啥 Cubemap,即立方体纹理,包含6张图像,每张图像对应立方体的一个面,跟二维纹理不同,我们使用三维坐标去对这种纹理进行采样, 在unity中,可以使用Cubemap来实现天空 ...
- 【转】外国朋友出的js题目,你能对几道
原文地址 http://perfectionkills.com/javascript-quiz/ 中文地址加解释:by Aaron:http://www.cnblogs.com/aaronjs/p/3 ...
- UOJ #356. 【JOI2017春季合宿】Port Facility
Description 小M有两个本质不同的栈. 无聊的小M找来了n个玩具.之后小M把这n个玩具随机顺序加入某一个栈或把他们弹出. 现在小M告诉你每个玩具的入栈和出栈时间,现在她想考考小S,有多少种方 ...
- bootstrap table分页,重新数据查询时页码为当前页问题
问题描述: 使用bootstrap table时遇到一个小问题,第一次查询数据未5页,翻页到第5页后,选中条件再次查询数据时,传到后端页码仍旧为5,而此时数据量小于5页,表格显示为未查询到数据. 处理 ...
- C#中解决Response.AddHeader("Content-Disposition", "attachment; filename=" + filename)下载文件时文件名乱码的问题
问题:下载文件时文件名乱码怎么解决? 在C#写后台代码过程中,经常遇到下载文件出现文件名乱码的问题,在网上找了很多方法,总是存在浏览器不兼容的问题,当IE浏览器不乱码时,火狐浏览器就会乱码,后来经过反 ...
- attempt to write a readonly database错误的解决(C#,SQLite)
今天打包WPF程序,安装后总是打不开,查看监控日志原来是SQLite的问题,报错如图 当向SQLite数据库中存入新纪录时总是显示attempt to write a readonly a datab ...
- Packet for query is too large (5,145 > 1,024). You can change this value on the server by setting the 'max_allowed_packet' variable.
错误 在使用Mybatis generator时提示MySQL写入过大 Packet for query is too large (5,145 > 1,024). You can change ...
- Java Swing实战(三)文本组件JTextField和密码组件JPasswordField
接下来添加文本组件JTextField和密码组件JPasswordField. /** * @author: lishuai * @date: 2018/11/26 13:51 */ public c ...
- Leetcode 计划
如何正确高效地使用LeetCode? LeetCode按照怎样的顺序来刷题比较好? LeetCode 题目总结/分类 Leetcode 简略题解 - 共567题 500. Keyboard Row [ ...