PDA

View Full Version : update a recordset


yiouli1
07-12-2004, 08:57 AM
FUNCTION fixQuotes(theString)
fixQuotes=REPLACE(theString,"'","''")
END FUNCTION

if updateProduct<>"" then
sqlString="UPDATE Products SET"&_
"product_name='"&fixQuotes(productName)&"',"&_
"product_price="&productPrice&","&_
"product_picture='"&fixQuotes(productPicture)&"',"&_
"product_category='"&fixQuotes(productCategory)&"',"&_
"product_briefdesc='"&fixQuotes(productBriefDesc)&"',"&_
"product_fulldesc='"&fixQuotes(productFullDesc)&"',"&_
"product_status="&productStatus&"WHERE"&_
"product_id="&productID

Con.Execute sqlString -------->line 80
end if


I get the following error message:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
/manageproducts.asp, line 80

bruce
07-12-2004, 10:40 AM
i think the problem is at this line

sqlString="UPDATE Products SET"&_

change it to

sqlString="UPDATE Products SET "&_
^^

if there's still a problem, try print the sqlstring out rather than executing it


[b]quote:Originally posted by yiouli1

FUNCTION fixQuotes(theString)
fixQuotes=REPLACE(theString,"'","''")
END FUNCTION

if updateProduct<>"" then
sqlString="UPDATE Products SET"&_
"product_name='"&fixQuotes(productName)&"',"&_
"product_price="&productPrice&","&_
"product_picture='"&fixQuotes(productPicture)&"',"&_
"product_category='"&fixQuotes(productCategory)&"',"&_
"product_briefdesc='"&fixQuotes(productBriefDesc)&"',"&_
"product_fulldesc='"&fixQuotes(productFullDesc)&"',"&_
"product_status="&productStatus&"WHERE"&_
"product_id="&productID

Con.Execute sqlString -------->line 80
end if


I get the following error message:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
/manageproducts.asp, line 80

</blockquote id="quote"></font id="quote">