I have got problem in updating the access database.
THIS IS MY CODE
//

Dim con As New OleDb.OleDbConnection
    Dim spl As String
    Dim ds As New DataSet
    Dim da As New OleDb.OleDbDataAdapter
    
 
con.ConnectionString = "PROVIDER= Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Malai\Documents\database31.mdb"
        con.Open()
        spl = "select * from REMAINDERDETAILS"
        da = New OleDb.OleDbDataAdapter(spl, con)
        da.Fill(ds, "remind")
        con.Close()
        
        ds.Tables("remind").Rows(0).Item("PERSON NAME") = nametxt.Text
        ds.Tables("remind").Rows(0).Item("DESCRIPTION") = descriptiontxt.Text
        ds.Tables("remind").Rows(0).Item("REMDATE") = datetxt.Text
        da.Update(ds, "remind")
//
this gives me the following error

//da.Update(ds, "remind")//

Syntax error (missing operator) in query expression '((NUMBER = ?) AND ((? = 1 AND PERSON NAME IS NULL) OR (PERSON NAME = ?)) AND ((? = 1 AND DESCRIPTION IS NULL) OR (DESCRIPTION = ?)) AND ((? = 1 AND REMDATE IS NULL) OR (REMDATE = ?)))'.

Can anybody help me to proceed.

Edited 6 Years Ago by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

In order to update dataset/datatable you have to configure Insert,Update,Delete, and Select command of DataAdapter.


Use OleDbCommandBuilder class to populate insert,delete, and update commands.

Dim con As New OleDb.OleDbConnection
    Dim spl As String
    Dim ds As New DataSet
    Dim da As New OleDb.OleDbDataAdapter
    
con.ConnectionString = "PROVIDER= Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Malai\Documents\database31.mdb"
        con.Open()
        spl = "select * from REMAINDERDETAILS"
        da = New OleDb.OleDbDataAdapter(spl, con)

        Dim cb as new OleDb.OleDbCommandBuilder(da)
 
        da.Fill(ds, "remind")
        con.Close()
        
        ds.Tables("remind").Rows(0).Item("PERSON NAME") = nametxt.Text
        ds.Tables("remind").Rows(0).Item("DESCRIPTION") = descriptiontxt.Text
        ds.Tables("remind").Rows(0).Item("REMDATE") = datetxt.Text
        da.Update(ds, "remind")
This article has been dead for over six months. Start a new discussion instead.