首页 > 解决方案 > 收到“输入字符串格式不正确”错误

问题描述

for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
    c2.command("insert into facture_haraki values("'
    + dataGridView1.Rows[i].Cells[1].Value.ToString() + "','"
    + dataGridView1.Rows[i].Cells[5].Value.ToString() + "',"
    + Convert.ToDouble(dataGridView1.Rows[i].Cells[6].Value.ToString() + ",'"
    + dataGridView1.Rows[i].Cells[4].Value.ToString()) + "',"
    + Convert.ToDouble(dataGridView1.Rows[i].Cells[2].Value.ToString()) + ","
    + Convert.ToDouble(dataGridView1.Rows[i].Cells[3].Value.ToString()) + ","
    + Convert.ToDouble(dataGridView1.Rows[i].Cells[7].Value.ToString()) + ","
    + (lasttotal * 1500) + ","
    + lasttotal + ","
    + discount + ",'"
    + dataGridView1.Rows[i].Cells[0].Value.ToString() + "',"
    + width + ",'"
    + notes +
    "')");
}

在此处输入图像描述

标签: c#

解决方案


就像 emangusta 提到的那样,您有一个语法错误,导致语句被错误地解析。


推荐阅读