Sql Server与c#之间数据类型对应

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值