hey guys
i'm new here because noone else was replying on any other forums, i hope you can help.
i get the error message "syntax error in UPDATE statement" when my code reaches the line "myDataAdapter.update(ds, "Table") any ideas why and how to solve it?
Dim myConnection As OleDb.OleDbConnection = New OleDb.OleDbConnection
Dim myDataAdapter = New OleDb.OleDbDataAdapter
Dim ds As New DataSet
Dim Table As String = "authentication"
Dim sql As String = "Select * from " & Table
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUPdate.Click
myConnection.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = " & dbFilePath
myConnection.Open()
myDataAdapter = New OleDb.OleDbDataAdapter(sql, myConnection)
myDataAdapter.Fill(ds, "Table")
temp = txtNew.Text
temp2 = ds.Tables("Table").Rows(0).Item(1)
If txtUser.Text = ds.Tables("Table").Rows(0).Item(0) Then
If txtOld.Text = temp2 And txtNew.Text = txtConfirms.Text Then
encrypt()
Dim cb As New OleDb.OleDbCommandBuilder(myDataAdapter)
ds.Tables("Table").Rows(0).Item(1) = temp
myDataAdapter.Update(ds, "Table")
MsgBox("password updated")
Else
MsgBox("passwords did not match")
End If
Else
MsgBox("Username is incorrect")
End If
myConnection.Close()
End Sub
i'm new here because noone else was replying on any other forums, i hope you can help.
i get the error message "syntax error in UPDATE statement" when my code reaches the line "myDataAdapter.update(ds, "Table") any ideas why and how to solve it?
Dim myConnection As OleDb.OleDbConnection = New OleDb.OleDbConnection
Dim myDataAdapter = New OleDb.OleDbDataAdapter
Dim ds As New DataSet
Dim Table As String = "authentication"
Dim sql As String = "Select * from " & Table
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUPdate.Click
myConnection.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = " & dbFilePath
myConnection.Open()
myDataAdapter = New OleDb.OleDbDataAdapter(sql, myConnection)
myDataAdapter.Fill(ds, "Table")
temp = txtNew.Text
temp2 = ds.Tables("Table").Rows(0).Item(1)
If txtUser.Text = ds.Tables("Table").Rows(0).Item(0) Then
If txtOld.Text = temp2 And txtNew.Text = txtConfirms.Text Then
encrypt()
Dim cb As New OleDb.OleDbCommandBuilder(myDataAdapter)
ds.Tables("Table").Rows(0).Item(1) = temp
myDataAdapter.Update(ds, "Table")
MsgBox("password updated")
Else
MsgBox("passwords did not match")
End If
Else
MsgBox("Username is incorrect")
End If
myConnection.Close()
End Sub
Last edited: