Subject: UPDATE statement returns syntax error
Posted By: AviatorTim Post Date: 1/8/2004 11:12:54 AM
If anyone can identify why I'm getting an error message from this code, please let me know.

I'm getting the error message...
"syntax error in UPDATE statement"

...from the following code...    
Set objComm = Server.CreateObject("ADODB.Command")
objComm.ActiveConnection = strConnect
objComm.CommandText = "UPDATE clients SET Password = 'calvin' WHERE UserID LIKE 'jdoe'"
objComm.CommandType = adCmdText
objComm.Execute

The code seems correct.  What am I missing?

Also, I would like to substitute variable for both the password and UserID.  How would I do that?  Would it be something like "UPDATE clients SET Password = " & chr(39) & strPassword & chr(39) & " WHERE UserID LIKE " & chr(39) & strUserID & chr(39) & chr(34)?

Thanks for your help,
Tim
Reply By: planoie Reply Date: 1/8/2004 11:23:30 AM
I agree, your update looks alright.  There is no more detailed error information?


"UPDATE clients SET Password = '" & strPassword & "' WHERE UserID LIKE '" & strUserID & "'"

Peter
------------------------------------------------------
Work smarter, not harder.
Reply By: shahchi1 Reply Date: 1/8/2004 4:22:14 PM
Please post specfic error messages...

If you are using MS Access try enclosing Password column name in the brackets. e.g. [Password], SQL reserved word

Chirag Shah


Go to topic 8222

Return to index page 973
Return to index page 972
Return to index page 971
Return to index page 970
Return to index page 969
Return to index page 968
Return to index page 967
Return to index page 966
Return to index page 965
Return to index page 964