【发布时间】:2013-12-04 19:45:58
【问题描述】:
我执行这段代码:
t1.Rows[gid].Cells[3].Paragraphs.First()
.Append((Int32.Parse(calculateGetunitPrice(tblMaterialGroup.id))*(a+b+c)).ToString())
.FontSize(12)
.Font(new FontFamily("B Nazanin"));
a、b、c的值为:
a=24121
b=0
c=13311
并且“calculateGetunitPrice(tblMaterialGroup.id)”为 1
我收到了这个错误:
Input string wasn't in the correct format
这是我的 calculateGetunitPrice 函数:
public string calculateGetunitPriceForElse(int materialGroupId)
{
var q = from i in dbconnect.tblMaterialTenderAnnouncePrices
where i.companyId == _comWinnerID && i.MaterialGroupId == materialGroupId
select i.PriceForElse;
// int? sum = g => g.PriceForElse;
return q.ToString();
}
【问题讨论】:
-
显然
calculateGetunitPrice(tblMaterialGroup.id))*(a+b+c)).ToString()的格式不正确。检查此表达式的调试器值。 -
你能发布你的整个调用堆栈吗?
-
那我该怎么做呢?
-
在 System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean
-
q 是集合所以使用
q.First().ToString()或类似的东西