title: Syntax error in INSERT INTO Statement when writing to Access
body: <p>I am trying to write a program where I can write data to an Access DB but I keep getting the error “Syntax error in INSERT INTO statement”.</p>
  
  <p><code>FirstLast</code> is the name of the table; <code>First</code> and <code>Last</code> are columns in it.</p>
  
  <pre class="lang-vb prettyprint-override"><code>Imports System.Data.OleDb
  
  Public Class Form1
      Dim theConnectionString As New OleDbConnection
      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
          theConnectionString.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\user\Documents\Database1.accdb"
  
          Dim cmd As OleDbCommand = New OleDbCommand("INSERT INTO FirstLast (First, Last) VALUES (@First, TextBox1.text)", theConnectionString)
  
          cmd.Parameters.Add("@First", OleDbType.Char, 255).Value = TextBox1.Text
          cmd.Parameters.Add("@Last", OleDbType.Char, 255).Value = TextBox1.Text
  
          Try
              theConnectionString.Open()
              cmd.ExecuteNonQuery()
          Catch ex As Exception
              Throw ex
          Finally
              theConnectionString.Close()
          End Try
  
      End Sub
  End Class
  </code></pre>