decimal strmoney;strmoney =  reader.GetSqlDecimal(3). 
调试的时候老出错,

解决方案 »

  1.   

    reader中返回的第3个字段是什么格式的....对应的是不是null或者是空...
     
      

  2.   

    decimal       对应          Decimal  阿
    没有错吧??是不是没数据??你最好加个判断
    strmoney  = reader.IsDBNull()?0:reader.GetSqlDecimal(3);
      

  3.   

    reader.GetValue(3). 再转换事实
      

  4.   

    GetSqlDecimal()返回的是SqlTypes.SqlDecimal。
    SqlTypes.SqlDecimal strmoney;改成这样。
      

  5.   

    SQL Server里有decimal类型?是money才对...检查你的数据表对应字段的类型...
      

  6.   

    strmoney = reader.IsDBNull(3) ? 0 : reader.GetDecimal(3);
    提示指定的转换无效。3 是个decimal 累加后的值
      

  7.   

    大意了大意了-_-!...decimal和numeric等价...从来不用那个...
      

  8.   

    SQL SERVER 换成numeric也不行啊,怎么这样
      

  9.   

    numeric对应的C#数据类型是double...decimal和numeric等价应该也是double...你可以试试把数据表字段改成money或把程序中类型改成double...
      

  10.   

    数据库的decimal我都在c#一般都用float