0

我想知道如何使用 Math.Round 选项将包含 Convert.ToDouble 选项的以下插入查询的小数点四舍五入

 for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
            {
                con.sqlquery(@"Insert into TBL_PO_Cart(PO_No,ISBN_No,OrderQuantity,UnitPrice,Total) values('" + txtPONo.Text + "','" + dataGridView1.Rows[i].Cells[1].Value + "','" + Convert.ToInt32(dataGridView1.Rows[i].Cells[2].Value) + "','" + Convert.ToDouble(dataGridView1.Rows[i].Cells[3].Value) + "','" + Convert.ToDouble(dataGridView1.Rows[i].Cells[4].Value) + "')");
                con.mysqlconnection();
                con.nonquery();
            }

并且还需要知道如何在 datagridview 列中只显示 2 位小数。

4

1 回答 1

0

看看这里。

如何在DataGridView中格式化具有最大值和最小值的小数列?

于 2018-05-31T22:12:32.113 回答