嗨,我是 ac# 新手,有人会礼貌地告诉我如何将这段代码的值转换为双精度/四舍五入的十进制数。在此先感谢
DataTable dtValues = new DataTable("GetValues");
strValueNumber = ValueNumber[0].ToString();
dtGetValues = SQLMethods.GetValues(strValueNumber);
total = 0;
for (int i = 0; i < dtValues.Rows.Count; i++)
{
total1 = total1 + Convert.ToInt32(dtGetValues.Rows[i]["total_1"]);
total2 = total2 + Convert.ToDouble(dtGetValues.Rows[i]["total_2l"]) * .45;
tbtotal1.Text = total1.ToString();
tbtotal2.Text = total2.ToString();
}
}
catch (Exception ex)
{
MessageBox.Show("Error in returning selected Values. " +
"Processed with error:" + ex.Message);
}
}