Insert all data of a datagridview to database at once

前端 未结 7 770
南方客
南方客 2020-12-08 23:55

I have a datagridview which is created by various action and user\'s manipulation of data. I want to insert all the data of the gridview to the database at once, I know I co

相关标签:
7条回答
  • 2020-12-09 00:41

    You have a syntax error Please try the following syntax as given below:

    string StrQuery="INSERT INTO tableName VALUES ('" + dataGridView1.Rows[i].Cells[0].Value + "',' " + dataGridView1.Rows[i].Cells[1].Value + "', '" + dataGridView1.Rows[i].Cells[2].Value + "', '" + dataGridView1.Rows[i].Cells[3].Value + "',' " + dataGridView1.Rows[i].Cells[4].Value + "')";
    
    0 讨论(0)
提交回复
热议问题