i'm using this code to try and write a value to a table in an access database. 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. if you need any of my other code etc to help then just ask
Code: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





Reply With Quote