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
Kirtan PatelPosted May 11, 2009, 9:59 PM
take
at look here
http://www.mediafire.com/?sharekey=2e9d884c2476e3fa7069484bded33bcdbcec3d68ab7f5d53
utsav rathourPosted May 11, 2009, 9:31 PM
Kirtan PatelPosted May 11, 2009, 3:16 PM
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 :)