var data = (from objData in receiptData
select new
{
ITEM_NAME=objData.ITEM_NAME,
UNIT_NAME=objData.UNIT_NAME,
PACK = objData.PACK,
RECIEVED_QTY =objData.RECIEVED_QTY.Value.ToString("0"), // ***this statement invoke error***
LPRATE = objData.LPRATE,
AMT = objData.LPRATE.Value * objData.RECIEVED_QTY.Value,
ESL = objData.ESL,
REMARKS = objData.REMARKS,
CHALLAN_NO=objData.CHALLAN_NO,
VEH_NO=objData.VEH_NO
});
答案 0 :(得分:2)
试试这个
var data = (from objData in receiptData
select new
{
ITEM_NAME=objData.ITEM_NAME,
UNIT_NAME=objData.UNIT_NAME,
PACK = objData.PACK,
RECIEVED_QTY =objData.RECIEVED_QTY.Value.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture),
LPRATE = objData.LPRATE,
AMT = objData.LPRATE.Value * objData.RECIEVED_QTY.Value,
ESL = objData.ESL,
REMARKS = objData.REMARKS,
CHALLAN_NO=objData.CHALLAN_NO,
VEH_NO=objData.VEH_NO
});
答案 1 :(得分:1)
您应该参考Decimal.ToString Method来格式化小数。
答案 2 :(得分:0)
Math.Round(objData.RECIEVED_QTY.Value,2)