string sOrigPrice = GV_Books.Rows[index].Cells[5].Text;
                string sSellPrice = GV_Books.Rows[index].Cells[6].Text;
                rowNew["OrigPrice"] = Convert.ToDecimal(sOrigPrice.Substring(1,sOrigPrice.Length-1));
                rowNew["SellPrice"] = Convert.ToDecimal(sSellPrice.Substring(1,sSellPrice.Length-1));
語法上沒有錯吧!~~但是好像是提示,输入字符串的格式不正确 請指教

解决方案 »

  1.   

    确保在ToDecimal里的字符串是类似11 ,  33, 55这样的数字字符串,
    如果是"pig"这样的字符串,就是参数不对
      

  2.   

    Convert.ToDecimal  后面的不是数字类型的
      

  3.   

    需转换的不是数值型的!强烈建议转换时加入TRY CATCH
      

  4.   

    Convert.ToDecimal(sSellPrice.Substring(1,sSellPrice.Length-1));确定能转成数值
      

  5.   


    string sSellPrice = GV_Books.Rows[index].Cells[6].Text;
    在这一句设个断点,看看sSellPrice ,和 sOrigPrice.Substring(1,sOrigPrice.Length-1);是多少???就明白哪里错了。。
      

  6.   

    樓上~~~我的VS2005就是調試不了吖!~~~不懂出了什麽問題~~
    系統是WIN7
      

  7.   

    嗯!~~就是想不明白為什麽 GV_Books.Rows[index].Cells[6].Text是一個Money類型的. 我VS2005的斷點能做了!~~用的參數是"羊46.00"(人民幣),但還是"输入字符串的格式不正确"是不是不能用"羊"這個字符呢