我想知道如何使用 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 位小数。