将SQLServer数据类型转换为C#.Net类型
将SQLServer数据类型转换为C#.Net类型 /// <summary> /// 将SQLServer数据类型(如:varchar)转换为.Net类型(如:String) /// </summary> /// <param name="sqlTypeString">SQLServer数据类型</param> /// <returns></returns> public static string SqlTypeName2DotNetType(string sqlTypeString) { string[] SqlTypeNames = new string[] { "int", "varchar","bit" ,"datetime","decimal","float","image","money", "ntext","nvarchar","smalldatetime","smallint","text","bigint","binary","char","nchar","numeric", "real","smallmoney", "sql_variant","timestamp","tinyint","uniqueidentifier","varbinary"}; string[] DotNetTypes = new string[] {"int", "string","bool" ,"DateTime","Decimal","Double","Byte[]","Single", "string","string","DateTime","Int16","string","Int64","Byte[]","string","string","Decimal", "Single","Single", "Object","Byte[]","Byte","Guid","Byte[]"}; int i = Array.IndexOf(SqlTypeNames, sqlTypeString.ToLower()); return DotNetTypes[i]; } // 来源:www.CSFramework.com, C/S结构框架学习网 扫一扫加作者微信
参考文档:
将SQLServer数据类型转换为.Net中SqlDbType类型 C#.Net对象内存模型及堆/栈数据结构详解 (三) C#.NET DateTime时间格式转换为Unix时间戳格式(int类型) C# ADO.NET根据实体对象类型转换创建DataTable对象 C#数据转换类ConvertEx,封装.Net的Convert对象 C# 将数组、集合、可枚举类型转换成逗号分隔的字符串(String.Join) C#.NET数据类型(Type)与DbType的对应关系 DbType与C#.NET数据类型(Type)对应关系 MsSql数据类型(SqlDbType)与.NET类型(Type)对应关系 MySql数据类型(MySqlDbType)与.NET类型(Type)对应关系 Oracle数据类型(OracleDbType)与.NET类型(Type)对应关系 MsSql数据类型(SqlDbType)名称对应.NET类型(Type) MySql数据类型(MySqlDbType)名称对应.NET类型(Type) Oracle数据类型(OracleDbType)名称对应.NET类型(Type) C#.NET 处理SQL特殊数据类型Geography/Geometry/Hierarchyid/XML
其它资料:
什么是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内容管理系统 | |