Error inserting

May 11 2009 1:13 PM
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

Answers (3)