I'm trying to connect to a access database and post an update to a row in a table though code with Visual Basic 2005, but when I do, I'm getting a Syntax error with the update statment. I don't understand what I'm doing wrong since the update statment looks like one that would be generated by Visual Studio when working with datasets
Any help would be great,
Thanks Nathan
Code:
Private Sub UpdateTest()
Try
Using Conn As OleDbConnection = New OleDbConnection(My.Settings.BalanceAssistConnectionString)
Conn.Open()
Try
Using Com As OleDbCommand = Conn.CreateCommand
Com.CommandType = CommandType.Text
Com.CommandText = "Update MultiParam Set Phone = ?, Set WorkName = ? Where Name = ?"
Com.Parameters.AddWithValue("Phone", txtPhone.Text)
Com.Parameters.AddWithValue("WorkName", txtWorkName.Text)
Com.Parameters.AddWithValue("Name", txtName.Text)
Com.ExecuteNonQuery()
End Using
Catch ex As Exception
MessageBox.Show(ex.ToString, "Error With Insert")
End Try
Conn.Close()
End Using
Catch ex As Exception
MessageBox.Show("Could Not Open Connection To Database" & ex.ToString, "Connection Error")
End Try
MessageBox.Show("Update Complete")
End Sub
Thanks Nathan
Comment