Please Help me with my update on vb.net 2008!It's quite a simple code but when it comes to it tells me Syntax error in Update.The problem is where i highlited.Please help

Imports System.Data

Public Class frmgoods
    Dim Con As New OleDb.OleDbConnection
    Dim dbprovider As String
    Dim dbsource As String
    Dim ds As New DataSet
    Dim da As OleDb.OleDbDataAdapter
    Dim SQL As String
    Dim Inc, max As Integer
    Private Sub NavigateRecords()

        txt1.Text = ds.Tables("Goods").Rows(Inc).Item(0)


    End Sub

    Private Sub GoodsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Validate()
        Me.GoodsBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.ProjectDataSet)

    End Sub

    Private Sub frmgoods_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'ProjectDataSet.Goods' table. You can move, or remove it, as needed.
        Me.GoodsTableAdapter.Fill(Me.ProjectDataSet.Goods)


        Inc = 0
        dbprovider = "PROVIDER=Microsoft.Jet.OLEDB.4.0; "
        dbsource = "Data Source=C:\Users\Germain KASUKU\Documents\Project.mdb"
        Con.ConnectionString = dbprovider & dbsource
        Con.Open()

        SQL = "SELECT* FROM Goods"
        da = New OleDb.OleDbDataAdapter(SQL, Con)
        da.Fill(ds, "Goods")

        max = ds.Tables("Goods").Rows.Count
        Inc = -1
        Con.Close()

    End Sub

    Private Sub btnnext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnext.Click
        If Inc <> max - 1 Then
            Inc = Inc + 1
            NavigateRecords()
        Else
            MsgBox("No More Rows")
        End If
    End Sub

    Private Sub btnfirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnfirst.Click
        If Inc <> 0 Then
            Inc = 0
            NavigateRecords()
        End If
    End Sub

    Private Sub btnprev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnprev.Click
        If Inc > 0 Then
            Inc = Inc - 1
            NavigateRecords()
        Else
            MsgBox("First Record")
        End If
    End Sub

    Private Sub btnlast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlast.Click
        If Inc <> max - 1 Then
            Inc = max - 1
            NavigateRecords()
        End If
    End Sub

    Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click

        Dim cb As New OleDb.OleDbCommandBuilder(da)

        
        ds.Tables("Goods").Rows(Inc).Item(0) = txt1.Text
        da.Update(ds, "Goods")
      
        MsgBox("Data updated!")






    End Sub
End Class

Edited 6 Years Ago by __avd: Added [code] tags.

This article has been dead for over six months. Start a new discussion instead.