Error inserting
for (int i = 0; i < rows; i++)
{
values = dataGridView1.Rows[i].Cells[1].Value.ToString();
MessageBox.Show(values);
cm.CommandText="insert into check values('"+textBox1.Text+"','"+values+"','','');";
cm.Connection=cn;
MessageBox.Show(cm.CommandText.ToString());
cm.ExecuteNonQuery();
//MessageBox.Show(dataGridView1.Rows[i].Cells[1].Value.ToString());
values = "";
}
this shows an error on cm.ExecuteNonQuery();
please help asap
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Kirtan PatelRank #292 · 8.6K reputationPosted May 11, 2009, 11:16 AM EDT
Now its working fine and Inserts Successfully
you must rename the table from check to any other name because check is Reserved word for Database Query
Here is the Modified Project
http://www.mediafire.com/?idmhkztjtjk
Happy Coding :)
utsav rathour52 reputationPosted May 11, 2009, 5:31 PM EDT
Kirtan PatelRank #292 · 8.6K reputationPosted May 11, 2009, 5:59 PM EDT
take
at look here
http://www.mediafire.com/?sharekey=2e9d884c2476e3fa7069484bded33bcdbcec3d68ab7f5d53