MySql数据类型(MySqlDbType)与.NET类型(Type)对应关系
MySql数据类型(MySqlDbType)与.NET类型(Type)对应关系
C# Code:
/// <summary>
/// MySql数据类型对应.NET类型-MySql数据类型(MySqlDbType)与.NET类型(Type)对应关系
/// </summary>
public static IDictionary<MySqlDbType, Type> MySqlDbType2NetTypeMapping
{
get
{
IDictionary<MySqlDbType, Type> map = new Dictionary<MySqlDbType, Type>();
map.Add(MySqlDbType.Binary, typeof(System.Byte[]));
map.Add(MySqlDbType.Bit, typeof(System.Boolean));
map.Add(MySqlDbType.Blob, typeof(System.Byte[]));
map.Add(MySqlDbType.Byte, typeof(System.Byte));
map.Add(MySqlDbType.Date, typeof(System.DateTime));
map.Add(MySqlDbType.DateTime, typeof(System.DateTime));
map.Add(MySqlDbType.Decimal, typeof(System.Decimal));
map.Add(MySqlDbType.Double, typeof(System.Double));
map.Add(MySqlDbType.Enum, typeof(System.String));//enum可以自定义类型,常用的是0,1,也可以定义为boy,girl,secret
map.Add(MySqlDbType.Float, typeof(System.Double));
map.Add(MySqlDbType.Geometry, typeof(System.Object));//几何图形
map.Add(MySqlDbType.Guid, typeof(System.Guid));
map.Add(MySqlDbType.Int16, typeof(System.Int16));
map.Add(MySqlDbType.Int24, typeof(System.Int32));
map.Add(MySqlDbType.Int32, typeof(System.Int32));
map.Add(MySqlDbType.Int64, typeof(System.Int64));
map.Add(MySqlDbType.JSON, typeof(System.String));
map.Add(MySqlDbType.LongBlob, typeof(System.Byte[]));
map.Add(MySqlDbType.LongText, typeof(System.String));
map.Add(MySqlDbType.MediumBlob, typeof(System.Byte[]));
map.Add(MySqlDbType.MediumText, typeof(System.String));
map.Add(MySqlDbType.Newdate, typeof(System.DateTime));
map.Add(MySqlDbType.NewDecimal, typeof(System.Decimal));
map.Add(MySqlDbType.Set, typeof(System.String));//集合
map.Add(MySqlDbType.String, typeof(System.String));
map.Add(MySqlDbType.Text, typeof(System.String));
map.Add(MySqlDbType.Time, typeof(System.DateTime));
map.Add(MySqlDbType.Timestamp, typeof(System.DateTime));
map.Add(MySqlDbType.TinyBlob, typeof(System.Byte[]));
map.Add(MySqlDbType.TinyText, typeof(System.String));
map.Add(MySqlDbType.UByte, typeof(System.Byte));
map.Add(MySqlDbType.UInt16, typeof(System.UInt16));
map.Add(MySqlDbType.UInt24, typeof(System.UInt32));
map.Add(MySqlDbType.UInt32, typeof(System.UInt32));
map.Add(MySqlDbType.UInt64, typeof(System.UInt64));
map.Add(MySqlDbType.VarBinary, typeof(System.Byte[]));
map.Add(MySqlDbType.VarChar, typeof(System.String));
map.Add(MySqlDbType.VarString, typeof(System.String));
map.Add(MySqlDbType.Year, typeof(System.Int32));
return map;
}
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
/// <summary>
/// MySql数据类型对应.NET类型-MySql数据类型(MySqlDbType)与.NET类型(Type)对应关系
/// </summary>
public static IDictionary<MySqlDbType, Type> MySqlDbType2NetTypeMapping
{
get
{
IDictionary<MySqlDbType, Type> map = new Dictionary<MySqlDbType, Type>();
map.Add(MySqlDbType.Binary, typeof(System.Byte[]));
map.Add(MySqlDbType.Bit, typeof(System.Boolean));
map.Add(MySqlDbType.Blob, typeof(System.Byte[]));
map.Add(MySqlDbType.Byte, typeof(System.Byte));
map.Add(MySqlDbType.Date, typeof(System.DateTime));
map.Add(MySqlDbType.DateTime, typeof(System.DateTime));
map.Add(MySqlDbType.Decimal, typeof(System.Decimal));
map.Add(MySqlDbType.Double, typeof(System.Double));
map.Add(MySqlDbType.Enum, typeof(System.String));//enum可以自定义类型,常用的是0,1,也可以定义为boy,girl,secret
map.Add(MySqlDbType.Float, typeof(System.Double));
map.Add(MySqlDbType.Geometry, typeof(System.Object));//几何图形
map.Add(MySqlDbType.Guid, typeof(System.Guid));
map.Add(MySqlDbType.Int16, typeof(System.Int16));
map.Add(MySqlDbType.Int24, typeof(System.Int32));
map.Add(MySqlDbType.Int32, typeof(System.Int32));
map.Add(MySqlDbType.Int64, typeof(System.Int64));
map.Add(MySqlDbType.JSON, typeof(System.String));
map.Add(MySqlDbType.LongBlob, typeof(System.Byte[]));
map.Add(MySqlDbType.LongText, typeof(System.String));
map.Add(MySqlDbType.MediumBlob, typeof(System.Byte[]));
map.Add(MySqlDbType.MediumText, typeof(System.String));
map.Add(MySqlDbType.Newdate, typeof(System.DateTime));
map.Add(MySqlDbType.NewDecimal, typeof(System.Decimal));
map.Add(MySqlDbType.Set, typeof(System.String));//集合
map.Add(MySqlDbType.String, typeof(System.String));
map.Add(MySqlDbType.Text, typeof(System.String));
map.Add(MySqlDbType.Time, typeof(System.DateTime));
map.Add(MySqlDbType.Timestamp, typeof(System.DateTime));
map.Add(MySqlDbType.TinyBlob, typeof(System.Byte[]));
map.Add(MySqlDbType.TinyText, typeof(System.String));
map.Add(MySqlDbType.UByte, typeof(System.Byte));
map.Add(MySqlDbType.UInt16, typeof(System.UInt16));
map.Add(MySqlDbType.UInt24, typeof(System.UInt32));
map.Add(MySqlDbType.UInt32, typeof(System.UInt32));
map.Add(MySqlDbType.UInt64, typeof(System.UInt64));
map.Add(MySqlDbType.VarBinary, typeof(System.Byte[]));
map.Add(MySqlDbType.VarChar, typeof(System.String));
map.Add(MySqlDbType.VarString, typeof(System.String));
map.Add(MySqlDbType.Year, typeof(System.Int32));
return map;
}
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761

参考文档:
MySql数据类型(MySqlDbType)名称对应.NET类型(Type)
MySQL数据类型(MySqlDbType)数据类型名称对应DbType类型
Oracle数据类型(OracleDbType)与.NET类型(Type)对应关系
MsSql数据类型(SqlDbType)与.NET类型(Type)对应关系
DbType与C#.NET数据类型(Type)对应关系
C#.NET数据类型(Type)与DbType的对应关系
MsSQL/MySQL/Oracle三种常用数据库数据类型(Data Type)对应关系表
SqlServer数据类型、DbType类型、.NET类型与达梦数据类型关系表|C/S开发框架
Oracle数据类型(OracleDbType)名称对应.NET类型(Type)
MsSql数据类型(SqlDbType)名称对应.NET类型(Type)
将SQLServer数据类型转换为.Net中SqlDbType类型
C#.NET 处理SQL特殊数据类型Geography/Geometry/Hierarchyid/XML
SQL Server 数据类型对应.NET类型的EF模型定义|C/S开发框架
C#.NET 查询MYSQL报错:值类型与列类型不匹配不能在列中存储 。所需类型是MySqlDateTime
C#.NET给DataTable日期类型的列赋值报错:所需类型是 MySqlDateTime,值类型与列类型不匹配
将SQLServer数据类型转换为C#.Net类型
MySql数据类型(MySqlDbType)名称对应.NET类型(Type)
MySQL数据类型(MySqlDbType)数据类型名称对应DbType类型
Oracle数据类型(OracleDbType)与.NET类型(Type)对应关系
MsSql数据类型(SqlDbType)与.NET类型(Type)对应关系
DbType与C#.NET数据类型(Type)对应关系
C#.NET数据类型(Type)与DbType的对应关系
MsSQL/MySQL/Oracle三种常用数据库数据类型(Data Type)对应关系表
SqlServer数据类型、DbType类型、.NET类型与达梦数据类型关系表|C/S开发框架
Oracle数据类型(OracleDbType)名称对应.NET类型(Type)
MsSql数据类型(SqlDbType)名称对应.NET类型(Type)
将SQLServer数据类型转换为.Net中SqlDbType类型
C#.NET 处理SQL特殊数据类型Geography/Geometry/Hierarchyid/XML
SQL Server 数据类型对应.NET类型的EF模型定义|C/S开发框架
C#.NET 查询MYSQL报错:值类型与列类型不匹配不能在列中存储 。所需类型是MySqlDateTime
C#.NET给DataTable日期类型的列赋值报错:所需类型是 MySqlDateTime,值类型与列类型不匹配
将SQLServer数据类型转换为C#.Net类型
其它资料:
什么是C/S结构? | C/S框架核心组成部分 | C/S框架-WebService部署图 | C/S框架-权限管理 | C/S结构系统框架 - 5.1旗舰版介绍 | C/S结构系统框架 - 功能介绍 | C/S结构系统框架 - 产品列表 | C/S结构系统框架 - 应用展示(图) | 三层体系架构详解 | C/S架构轻量级快速开发框架 | C/S框架网客户案例 | WebApi快速开发框架 | C/S框架代码生成器 | 用户授权注册软件系统 | 版本自动升级软件 | 数据库底层应用框架 | CSFramework.CMS内容管理系统 |
什么是C/S结构? | C/S框架核心组成部分 | C/S框架-WebService部署图 | C/S框架-权限管理 | C/S结构系统框架 - 5.1旗舰版介绍 | C/S结构系统框架 - 功能介绍 | C/S结构系统框架 - 产品列表 | C/S结构系统框架 - 应用展示(图) | 三层体系架构详解 | C/S架构轻量级快速开发框架 | C/S框架网客户案例 | WebApi快速开发框架 | C/S框架代码生成器 | 用户授权注册软件系统 | 版本自动升级软件 | 数据库底层应用框架 | CSFramework.CMS内容管理系统 |
在线客服
