0

Hey, I face a problem in updating data to the original database.

Everytime when I clicked the update button. an error came out in the coding where I highlighted below, saying syntax error in update statement!

Can somebody please pin-point my mistake?:'(

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
         Me.JigTableAdapter.Fill(Me.JigDataSet.jig)

        con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\jig.mdb"
        con.Open()

        sql = "SELECT * FROM jig"
        da = New OleDb.OleDbDataAdapter(sql, con)

        da.Fill(ds, "jig")
        con.Close()

        MaxRows = ds.Tables("jig").Rows.Count
        inc = 0

    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("jig").Rows(inc).Item(0) = JIG_NOTextBox.Text()
        ds.Tables("jig").Rows(inc).Item(1) = JIG_NAMETextBox.Text()
        ds.Tables("jig").Rows(inc).Item(2) = JIG_MODELTextBox.Text()
        
[I]        da.Update(ds, "jig")[/I]

        MsgBox("Data updated!")

    End Sub
2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by daviddoria
0

Please wrap your code in code tags.

I think you have to explicitly define an update command for the data adapter.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.