简体   繁体   中英

am getting “input string was not in a correct format” error

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 +
    "')");
}

在此处输入图片说明

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

It's solved thanks to

Convert.ToDouble(dataGridView1.Rows[i].Cells[6].Value.ToString() +

missing to close the opened ( in this statement! :D

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM