I am trying to create an update query but it is failing to make any changes.
Below is the code I have...
I have a form with a button to query the db and return records based on the criteria selected. The idea here is to allow the user to then make changes to that record and save back to the db. Can anyone tell me where the error is? Thanks!!
Below is the code I have...
Code:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Dim strSqlEditRecord As String
Dim myCmd As OleDb.OleDbCommand
myCmd = Nothing
strSqlEditRecord = "UPDATE tblMain SET Per_Hour_Quota= '" & txtQuota.Text & "' WHERE EnteredRecord= '" & lblRecordNumber.Text & "';"
myCmd = New OleDb.OleDbCommand(strSqlEditRecord, gMDB)
myCmd.Parameters.AddWithValue("@Per_Hour_Quota", txtQuota.Text)
myCmd.CommandType = CommandType.Text
myCmd.CommandTimeout = 60
myCmd.ExecuteNonQuery()
MsgBox("This record has been updated in the database.", MsgBoxStyle.Information, "Saved Record")
Clear()
End Sub
Comment