MsSql数据类型(SqlDbType)名称对应.NET类型(Type)
作者:C/S框架网|www.cscode.ne  发布日期:2021/06/08 11:01:35
  MsSql数据类型(SqlDbType)名称对应.NET类型(Type)

MsSql数据类型(SqlDbType)名称对应.NET类型(Type)



C# Code:

/// <summary>
/// MsSql数据类型简称对应.NET类型 - MsSql数据类型(SqlDbType)名称对应.NET类型(Type)
/// </summary>
public static IDictionary<string, Type> SqlDbTypeName2NetTypeMapping
{
  
get
  {
    IDictionary
<String, Type> map = new Dictionary<String, Type>();
    map.Add(
"BigInt", typeof(System.Int64));
    map.Add(
"Binary", typeof(System.Byte[]));
    map.Add(
"Bit", typeof(System.Boolean));
    map.Add(
"Char", typeof(System.Char));
    map.Add(
"Cursor", typeof(System.Object));//前端不用
    
map.Add("Date", typeof(System.DateTime));
    map.Add(
"DateTime", typeof(System.DateTime));
    map.Add(
"DateTime2", typeof(System.DateTime));
    map.Add(
"DateTimeOffset", typeof(System.DateTimeOffset));
    map.Add(
"Decimal", typeof(System.Decimal));
    map.Add(
"Float", typeof(System.Double));
    map.Add(
"Image", typeof(System.Byte[]));
    map.Add(
"Int", typeof(System.Int32));
    map.Add(
"Money", typeof(System.Decimal));
    map.Add(
"NChar", typeof(System.String));
    map.Add(
"NText", typeof(System.String));
    map.Add(
"NVarChar", typeof(System.String));
    map.Add(
"Real", typeof(System.Double));//float类型,double
    
map.Add("SmallDateTime", typeof(System.DateTime));
    map.Add(
"SmallInt", typeof(System.Int16));
    map.Add(
"SmallMoney", typeof(System.Decimal));
    map.Add(
"sql_variant", typeof(System.Object));//sql_variant
    
map.Add("Structured", typeof(System.Object));//前端不用
    
map.Add("Text", typeof(System.String));
    map.Add(
"Time", typeof(System.DateTime));
    map.Add(
"Timestamp", typeof(System.DateTime));//byte[], 可以定义为datetime
    
map.Add("TinyInt", typeof(System.Int16));
    map.Add(
"Udt", typeof(System.Object));//前端不用,UDT是用户自定义数据类型
    
map.Add("UniqueIdentifier", typeof(System.Guid));
    map.Add(
"VarBinary", typeof(System.Byte[]));
    map.Add(
"VarChar", typeof(System.String));
    map.Add(
"Variant", typeof(System.Object));//sql_variant
    
map.Add("Xml", typeof(System.String));
    
    
return map;
  }
}


//来源:C/S框架网 | www.csframework.com | QQ:23404761





C/S框架网|原创精神.创造价值.打造精品

扫一扫加微信
C/S框架网作者微信 C/S框架网|原创作品.质量保障.竭诚为您服务


上一篇 下一篇