title: OLEDB Database command builder update function not working - Visual Basic
body: <p>I am attempting to add a row to an access database with the Adapter.update() Function but I keep getting this error:</p>
  
  <pre><code>  System.Data.OleDb.OleDbException was unhandled
    ErrorCode=-2147217900
     HResult=-2147217900
    Message=Syntax error in INSERT INTO statement.
    Source=Microsoft JET Database Engine
     StackTrace:
     at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
     at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
     at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
     at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
     at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
     at test.Form1.Form1_Load(Object sender, EventArgs e)
     at System.EventHandler.Invoke(Object sender, EventArgs e)
     at System.Windows.Forms.Form.OnLoad(EventArgs e)
     at System.Windows.Forms.Form.OnCreateControl()
     at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
     at System.Windows.Forms.Control.CreateControl()
     at System.Windows.Forms.Control.WmShowWindow(Message&amp; m)
     at System.Windows.Forms.Control.WndProc(Message&amp; m)
     at System.Windows.Forms.ScrollableControl.WndProc(Message&amp; m)
     at System.Windows.Forms.Form.WmShowWindow(Message&amp; m)
     at System.Windows.Forms.Form.WndProc(Message&amp; m)
     at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m)
     at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m)
     at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  InnerException: 
  </code></pre>
  
  <p>I have three databases where I attempt to do this and one does not raise an error but the others do. I have tried to create new Databases but they still raise the error. All of the databases use the .mdb file exstension. Does anyone have an idea what might be happening?</p>
  
  <p>Here is the code where I attempt to update the table</p>
  
  <pre><code>Imports System.Data.OleDb
  Public Class Form1
  Dim Connection As New OleDbConnection
  Dim Adapter As OleDbDataAdapter
  Dim Table As New DataTable
  Dim Command As OleDbCommandBuilder
  Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      Connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\ethan\OneDrive\Documents\test3.mdb"
      Adapter = New OleDbDataAdapter("Select * From Things", Connection)
      Command = New OleDbCommandBuilder(Adapter)
  
      Adapter.Fill(Table)
      Dim NewRow As DataRow = Table.NewRow
      NewRow("thing") = "Grapes"
      NewRow("count") = 4
      Table.Rows.Add(NewRow)
      Adapter.Update(Table)
    End Sub
  End Class
  </code></pre>