sql_language thread: problem with updating my database...
> incorrect syntax near '=',
> SQLstmt = "UPDATE Students SET "
> SQLStmt = SQLstmt & "lastname='" & form_lastname & "',"
> SQLstmt = SQLstmt & "firstname='" & form_firstname & "',"
> SQLstmt = SQLstmt & "year='" & form_year & "'"
> SQLstmt = SQLstmt & " WHERE ID=" & form_id
If year is a numeric field, don't forget to leave out the ' ' marks.
Also note that if lastname is O'Reilly then you get
UPDATE Students SET lastname='O'Reilly', ...
which will give you a syntax error. For this it's common to go
> SQLstmt = "UPDATE Students SET "
> SQLStmt = SQLstmt & "lastname='" & replace(form_lastname,"'","''") & "',"
> SQLstmt = SQLstmt & "firstname='" & replace(form_firstname,"'","''") &
"',"
> SQLstmt = SQLstmt & "year='" & form_year & "'"
> SQLstmt = SQLstmt & " WHERE ID=" & form_id
The only other thing I can think of is the form_id is not numeric.
As richard says, to say much more, we need to see what the actual SQL is, so
straight after the above code, insert a response.write(SQLstmt) and let us
see the output!
Cheers,
Steve