Click to See Complete Forum and Search --> : Update problem


jrthor2
07-12-2003, 11:41 AM
What is wrong with this statement? I keep getting

Microsoft JET Database Engine error '80040e14'

Syntax error in UPDATE statement.

My code:

SQLstmt = "UPDATE users SET "
SQLstmt = SQLstmt & "Password = '" & strpassword & "', "
SQLstmt = SQLstmt & "Email = '" & stremail & "' "
SQLstmt = SQLstmt & "WHERE Username = '" & strusername & "'"

response.write(SQLstmt)
conn.execute(SQLstmt)

simflex
07-12-2003, 12:25 PM
So I would change the code to this; some of the fields like email are reserved words.
SQLstmt = "UPDATE users SET "
SQLstmt = SQLstmt & "[Password] = '" & strpassword & "', " & _
SQLstmt = SQLstmt & "[Email] = '" & stremail & "' "
SQLstmt = SQLstmt & "WHERE [Username] = '" & strusername & "'"

You can even rename the fields to myPassword, myEmail, myUsername or something like like.

jrthor2
07-12-2003, 08:16 PM
Thanks, I keep forgetting about reserved words :-)