private void FrmPurchaseStockReceipt_Load(object sender, EventArgs e)
{
GetAllTools();
SetPageTools();
InitData();
ClickInitial();
this.dgv_Data.Columns["flotprice"].DefaultCellStyle.Format = "C2";
this.dgv_Data.Columns["flotamount"].DefaultCellStyle.Format = "0.00"; }
{
GetAllTools();
SetPageTools();
InitData();
ClickInitial();
this.dgv_Data.Columns["flotprice"].DefaultCellStyle.Format = "C2";
this.dgv_Data.Columns["flotamount"].DefaultCellStyle.Format = "0.00"; }
1、decimal.Round(decimal.Parse("0.3333333"),2)
2、String.Format("{0:F}","0.333333");//默认为保留两位
so,建议你简单的用String.Format来处理下,先达到目的!
MessageBox.Show(this.dgv_Data.Rows[0].Cells["flotprice"].Value.GetType().ToString());
这行,看下弹出框显示的那列值的具体类型
真是奇怪,我用的是oracle,数据库明明是number类型,可是,message出来的类型是system.string
比如这样!
DataTable dt = ibusinessService.PurchaseOrder_GetPurchaseOrderDetail(out outEx, lngOrderReceiptId);
dt.Columns["flotprice"].DataType = System.Int32;