I cannot figure out why ASP.NET is claiming I have a syntax error in my update statement. Any clues?
Dim strsql, dbpath As String
dbpath = Server.MapPath(".")
strsql = "UPDATE gatecodes SET "
'strsql &= "uname='" & uname & "', "
strsql &= "month='" & cmbmonth.SelectedItem.Value & "', "
strsql &= "gatecode='" & txtgatecode.Text & "' "
strsql &= "WHERE month='" & txtmonth.Text & "'"
Dim con As New OleDb.OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" & dbpath & "\msadb\bfac.mdb;")
Dim cmd As New OleDb.OleDbCommand(strsql, con)
Dim added As Integer
Try
con.Open()
added = cmd.ExecuteNonQuery
lblstatus.Text = "Gatecode Updated."
Catch ex As Exception
lblstatus.Text = "Error inserting record! " & ex.Message
Finally
If (Not con Is Nothing) Then
con.Close()
End If
End Try
Dim strsql, dbpath As String
dbpath = Server.MapPath(".")
strsql = "UPDATE gatecodes SET "
'strsql &= "uname='" & uname & "', "
strsql &= "month='" & cmbmonth.SelectedItem.Value & "', "
strsql &= "gatecode='" & txtgatecode.Text & "' "
strsql &= "WHERE month='" & txtmonth.Text & "'"
Dim con As New OleDb.OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" & dbpath & "\msadb\bfac.mdb;")
Dim cmd As New OleDb.OleDbCommand(strsql, con)
Dim added As Integer
Try
con.Open()
added = cmd.ExecuteNonQuery
lblstatus.Text = "Gatecode Updated."
Catch ex As Exception
lblstatus.Text = "Error inserting record! " & ex.Message
Finally
If (Not con Is Nothing) Then
con.Close()
End If
End Try