title: How to solve a syntax error when using this INSERT INTO statement and the .NET OleDb namespace?
body: <p>I keep getting an error when I attempt to insert values into a Access database.  </p>
  
  <p>The error is syntactic, which leads to the following exception:</p>
  
  <blockquote>
    <p>OleDbException was unhandled Syntax error in INSERT INTO statement.</p>
  </blockquote>
  
  <pre><code>private OleDbConnection myCon;
  
  public Form1()
  {
      InitializeComponent();
      myCon = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\File.mdb");
  }
  
  private void insertuser_Click(object sender, EventArgs e)
  {
      OleDbCommand cmd = new OleDbCommand();
      myCon.Open();
      cmd.Connection = myCon;
      cmd.CommandType = CommandType.Text;
  
      cmd.CommandText = "INSERT INTO User ([UserID], [Forename], [Surname], " +
                                          "[DateOfBirth], [TargetWeight], [TargetCalories], [Height]) " +
                        "VALUES ('" + userid.Text.ToString() + "' , '" +
                                      fname.Text.ToString() + "' , '" +
                                      sname.Text.ToString() + "' , '" +
                                      dob.Text.ToString() + "' , '" +
                                      tarweight.Text.ToString() + "' , '" +
                                      tarcal.Text.ToString() + "' , '" +
                                      height.Text.ToString() + "')";
  
      cmd.ExecuteNonQuery();
      myCon.Close();
  }
  </code></pre>