我利用StringBuilder把一个DataTable循环打出来,循环里面包括了一个相乘的关系大致如下
SB.Append("<tr>td align='center'>" + float.Parse(Dt2.Rows[i]["f_M_UnitPrice"].ToString()) * int.Parse(Dt2.Rows[j]["f_i_ProductCount"].ToString()) + "</td></tr>");
但总是报错.不知道那位大哥帮个忙.
SB.Append("<tr>td align='center'>" + float.Parse(Dt2.Rows[i]["f_M_UnitPrice"].ToString()) * int.Parse(Dt2.Rows[j]["f_i_ProductCount"].ToString()) + "</td></tr>");
但总是报错.不知道那位大哥帮个忙.
float 要先转换成 string
STRING STR1=float.Parse(Dt2.Rows[i]["f_M_UnitPrice"].ToString()) * int.Parse(Dt2.Rows[j]["f_i_ProductCount"].ToString())SB.Append(" <tr>td align='center'>" + STR1 + " </td> </tr>");
INT B=int.Parse(Dt2.Rows[j]["f_i_ProductCount"].ToString());
INT C=A*B;STRING STR1=C.TOSTRING();
SB.Append(" <tr>td align='center'>" + STR1 + " </td> </tr>");