加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sqlserver与c#中数据类型的…

发布时间:2020-12-12 16:05:02 所属栏目:MsSql教程 来源:网络整理
导读:case:sqlserver类型 reval:c#类型 原文地址: sqlserver与c#中数据类型的对应关系? ? ? 作者: 伟帛 private string changetocsharptype(string type) { string reval=string.empty; switch(type.tolower()) { case "int ": reval= "int32 "; break; case "
case:sqlserver类型
reval:c#类型 原文地址:sqlserver与c#中数据类型的对应关系??? 作者:伟帛

private   string   changetocsharptype(string   type) 
    { 
      string   reval=string.empty; 
      switch(type.tolower()) 
      { 
        case   "int ": 
          reval=   "int32 "; 
          break; 
        case   "text ": 
          reval=   "string "; 
          break; 
        case   "bigint ": 
          reval=   "int64 "; 
          break; 
        case   "binary ": 
          reval=   "system.byte[] "; 
          break; 
        case   "bit ": 
          reval=   "boolean "; 
          break; 
        case   "char ": 
          reval=   "string "; 
          break; 
        case   "datetime ": 
          reval=   "system.datetime "; 
          break; 
        case   "decimal ": 
          reval=   "system.decimal "; 
          break; 
        case   "float ": 
          reval=   "system.double "; 
          break; 
        case   "image ": 
          reval=   "system.byte[] "; 
          break; 
        case   "money ": 
          reval=   "system.decimal "; 
          break; 
        case   "nchar ": 
          reval=   "string "; 
          break; 
        case   "ntext ": 
          reval=   "string "; 
          break; 
        case   "numeric ": 
          reval=   "system.decimal "; 
          break; 
        case   "nvarchar ": 
          reval=   "string "; 
          break; 
        case   "real ": 
          reval=   "system.single "; 
          break; 
        case   "smalldatetime ": 
          reval=   "system.datetime "; 
          break; 
        case   "smallint ": 
          reval=   "int16 "; 
          break; 
        case   "smallmoney ": 
          reval=   "system.decimal "; 
          break; 
        case   "timestamp ": 
          reval=   "system.datetime "; 
          break; 
        case   "tinyint ": 
          reval=   "system.byte "; 
          break; 
        case   "uniqueidentifier ": 
          reval=   "system.guid "; 
          break; 
        case   "varbinary ": 
          reval=   "system.byte[] "; 
          break; 
        case   "varchar ": 
          reval=   "string "; 
          break; 
        case   "variant ": 
          reval= "object "; 
          break; 
        default: 
          reval=   "string "; 
          break; 
      } 
      return   reval; 
    }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读