Akemi Chou

Akemi Chou

  • NA
  • 13
  • 8.8k

Syntax Error in INSERT INTO Statement (Insert Records)

Jul 1 2014 12:27 PM
I always have experienced this "INSERT INTO Statement" Syntax Error, can someone help me how to solve this?

try
            {

                OleDbConnection Con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\\MotoFix.mdb;");


              
                Con.Open();
                OleDbCommand Com = new OleDbCommand();

                Com.Connection = Con;
                 Com.CommandText = "INSERT INTO Order VALUES ('" + txtRandomOrder.Text + "','" + txtCode.Text + "')";
                  Com.ExecuteNonQuery();
                 Con.Close();
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
            }


Answers (3)