I'm getting this error.
SQLite error
near "16": syntax error
On the code:
With breapoints etc it does show the values it has to insert into my database. But it just doesn't and gives me the Near "16" syntax error. Am I just beng stupid and overlooking something or is my code just totally wrong?
SQLite error
near "16": syntax error
On the code:
Code:
private void btnUpdate_Click(object sender, EventArgs e)
{
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
string StrQuery = @"INSERT INTO Test VALUES (" + dataGridView1.Rows[i].Cells["Column1"].Value + ", " + dataGridView1.Rows[i].Cells["Column2"].Value + ", " + dataGridView1.Rows[i].Cells["Column3"].Value + ", " + dataGridView1.Rows[i].Cells["Column4"].Value + ", " + dataGridView1.Rows[i].Cells["Column5"].Value +");";
try
{
SQLiteConnection conn = new SQLiteConnection(connString);
conn.Open();
using (SQLiteCommand comm = new SQLiteCommand(StrQuery, conn))
{
comm.ExecuteNonQuery();
}
conn.Close();
}
catch (Exception crap)
{
MessageBox.Show(crap.ToString());
}
}
}

Comment