DataAdapter.update(DataSet) gives the error message that syntax error to update the access database. Please help. Thanks. RRS feed

  • Question

  • Imports System.Data.OleDb

    Public Class Form1

        Dim con As New OleDbConnection
        Dim sql As String = "Select * from Table1"
        Dim ds As New DataSet
        Dim da As OleDb.OleDbDataAdapter

        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

            con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=H:\vb  learning\Practice\Database1\Share list.accdb")
            da = New OleDb.OleDbDataAdapter(sql, con)
            da.Fill(ds, "AddressBook")

        End Sub

        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

            Dim cb As New OleDb.OleDbCommandBuilder(da)
            ds.Tables("AddressBook").Rows(0).Item(3) = TextBox1.text
            da.Update(ds, "AddressBook")
        End Sub

    End Class

    Wednesday, August 7, 2019 11:38 AM

All replies

  • Hello,

    Please specify the exact error message you have in regards to the update actions. Also, would be great to see the Update statement generated by the OleDbCommandBuilder as to inspecting the query and especially the WHERE clause.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    profile for Karen Payne on Stack Exchange

    Wednesday, August 7, 2019 1:20 PM
  • Hi,

    see the following link, field name contains a space

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Thursday, August 8, 2019 5:23 AM