title: Syntax error in insert into statement(MS.net code with MS Access database)
body: <p>I got an error on running this code. The error exist where i am using the "insert into" statement. I cant understand what is the problem. </p>
  
  <p>ERROR: Syntax Error in INSERT INTO statement</p>
  
  <p>Please tell me where is the problem in the given code</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  using System.Data.OleDb;
  
  namespace GTC
  {
      public partial class Adminhome : Form
      {
          public Adminhome()
          {
              InitializeComponent();
          }
  
          OleDbConnection cn = new OleDbConnection("provider=microsoft.ace.oledb.12.0;data source=|DataDirectory|/GTC.accdb;");
  
  
  
  
          void clear()
          {
              textBox1.Text = "";
              comboBox1.Text = "-Select-";
              textBox2.Text = "";
              textBox3.Text = "";
              textBox4.Text = "";
              textBox5.Text = "";
          }
  
          private void Form1_Load(object sender, EventArgs e)
          {
              cn.Open();
              // TODO: This line of code loads data into the 'GTCDataSet2.Society' table. You can move, or remove it, as needed.
              this.SocietyTableAdapter.Fill(this.GTCDataSet2.Society);
              // TODO: This line of code loads data into the 'GTCDataSet2.User' table. You can move, or remove it, as needed.
              this.UserTableAdapter.Fill(this.GTCDataSet2.User);
              this.reportViewer1.RefreshReport();
              this.reportViewer2.RefreshReport();
          }
  
          private void button2_Click(object sender, EventArgs e)
          {
              try
              {
                  String q = String.Format("insert into Society values('{0}')", textBox5.Text);
                  OleDbCommand cmd = new OleDbCommand(q, cn);
                  cmd.ExecuteNonQuery();
                  label8.Text = "Society Added...";
                  clear();
              }
              catch (Exception err)
              {
                  label8.Text = err.Message;
              }
          }
  
          private void button1_Click_1(object sender, EventArgs e)
          {
              try
              {
                  String q = String.Format("insert into User values('{0}','{1}','{2}','{3}','{4}')", textBox1.Text, comboBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text);
                  OleDbCommand cmd = new OleDbCommand(q, cn);
                  cmd.ExecuteNonQuery();
                  label6.Text = "User Added...";
                  clear();
              }
              catch (Exception err)
              {
                  label6.Text = err.Message;
              }
          }
      }
  }
  </code></pre>