日期:2014-05-17 浏览次数:21019 次
DataSet xfs = sqlhelper.ExecutDataset("select sum(sj) sj1,sum(lc) lc1 from  main where   datediff(d,date,'" + hf1.Value + "')<=0 and datediff(d,date,'" + hf2.Value + "')>=0");
        if (xfs != null && xfs.Tables[0].Rows.Count > 0)
        {
            DataTable dt = xfs.Tables[0];
            DataRow dr=xfs.Tables[0].Rows[0];
            sjxfs = Convert.ToDecimal(dr["sj1"].ToString());
            lcxfs = Convert.ToDecimal(dr["lc1"].ToString());
            list1.DataSource = dt;
            list1.DataBind();
        }异常详细信息: System.FormatException: 输入字符串的格式不正确。76行出错,数据库里数据都是float类型的,求解决办法
源错误:
行 74: DataTable dt = xfs.Tables[0];
行 75: DataRow dr=xfs.Tables[0].Rows[0];
行 76: sjxfs = Convert.ToDecimal(dr["sj1"].ToString());