微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

sqlserver与c#中数据类型的对应关系

 

sqlserver与c#中数据类型的对应关系

/// /// 数据库中与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":      // 0为false      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; }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐