I got the following error in my code today:
Syntax error in INSERT INTO statement.
OleDbCommand cmd = new OleDbCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText="Insert into Cursanti([ID],[Nume],[Prenume],[Sex],[Varsta],[Ziua-1],[Ziua-2],[Ora-1],[Ora2],[E-mail],[Telefon],[Referal],[Partic/Grup],[Adult/Copil)] Values ('"+id_b.Text+"','"+name_t.Text+"','"+surname_t.Text+"','"+sex+"',"+age_t.Text+"','"+ziua1.Text+"','"+ziua2.Text+"','"+ora1.Text+"','"+ora2.Text+"','"+email_b.Text+"','"+phone_b.Text+"','"+from_t.Text+"','"+ore+"','"+categorie+"')"; cmd.Connection = con; con.Open(); cmd.ExecuteNonQuery(); con.Close();
The error points at "cmd.ExecuteNonQuery();"
Searched the other topics, saw that people had similar problems, but i didn't quite get what should be done. It's my first day working with databases as well so sorry if it's a silly question.
Things i did to try and solve the problem:
1. Added  for each ID, Nume etc.
2. Checked if the types are all the same.
3. Checked for anything typed wrong.
Sorry for some of the code, but used romanian in my project.