Question command builder not recognised and syntax error

Jazman667

Member
Joined
Mar 30, 2010
Messages
5
Programming Experience
Beginner
i'm using this code to try and write a value to a table in an access database. when i try to write oledb.oledbcommandbuilder, intellisense doesn't recognize this but it doesn't throw an error up for that line either. when i try to execute this code i get the error "syntax error in UPDATE statement" i really need help with this and realise its probably a really simple problem but could you please help! i've posted this problem here before and noones answered so i'm posting it again.


VB.NET:
   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUPdate.Click
        Dim myConnection As OleDb.OleDbConnection
        Dim ds As New DataSet
        myConnection = New OleDb.OleDbConnection
        Dim myDataAdapter As OleDb.OleDbDataAdapter
        Dim myTable As String = "Authentication"


        myConnection.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = " & dbFilePath
        myConnection.Open()
        Dim sql As String = "Select * from " & myTable
        myDataAdapter = New OleDb.OleDbDataAdapter(sql, myConnection)
        Dim cb As New OleDb.OleDbCommandBuilder(myDataAdapter)
        myDataAdapter.Fill(ds, "myTable")

        myConnection.Close()
        temp = txtNew.Text
        temp2 = ds.Tables("myTable").Rows(0).Item(1)

        If txtUser.Text = ds.Tables("myTable").Rows(0).Item(0) Then
            If txtOld.Text = temp2 And txtNew.Text = txtConfirms.Text Then
                encrypt()

                ds.Tables("myTable").Rows(0).Item(1) = temp
' error message on next line
                myDataAdapter.Update(ds, "myTable")

                MsgBox("password updated")
            Else
                MsgBox("passwords did not match")

            End If
        Else
            MsgBox("Username is incorrect")
        End If

    End Sub
 
Back
Top