Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax Error in UPDATE Statement

Status
Not open for further replies.

Shift838

IS-IT--Management
Jan 27, 2003
987
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top