Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 8th, 2004, 12:12 PM
Registered User
 
Join Date: Jan 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default UPDATE statement returns syntax error

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
 
Old January 8th, 2004, 12:23 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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.
 
Old January 8th, 2004, 05:22 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax Error in the update statement annie_t Access ASP 1 February 1st, 2005 12:48 PM
Syntax error in INSERT INTO statement mega ASP.NET 1.0 and 1.1 Basics 3 January 12th, 2005 04:30 PM
Syntax error on SQL statement Chris1 Access VBA 1 September 7th, 2004 07:47 AM
Syntax error in INSERT INTO statement remnatch Access ASP 9 July 8th, 2004 12:09 PM
Syntax Error in Insert Statement mahulda Classic ASP Databases 2 June 18th, 2004 05:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.