• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

ASP probs please help!

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

markodude

Member
Joined
Jul 15, 2002
Location
Europe
I am in the middle of programming an E-commerce application with classic asp and M$ Access as the DB.
I have the following problem when I run a new bit of code.

"Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'product_name=Tap Shoes AND product_size=2'.

/store/product2.asp, line 15"

Heres the code lines 1-15

<%
' Get the Size
size1 = TRIM( Request( "size1" ) )
prodname = TRIM( Request( "prodname" ) )
' Open the Database Connection
Set Con = Server.CreateObject( "ADODB.Connection" )
Con.Open "accessDSN"

' Get the Product Informatino
sqlString = "SELECT * FROM Products "
sqlString = sqlString & "WHERE product_name=" & prodname &_
" AND product_size=" & size1
Set RS = Server.CreateObject( "ADODB.Recordset" )
RS.ActiveConnection = Con
RS.Open sqlString
%>

I have been at the screen for too long now and I am sure its something stupid I have done. The variables prodname and size1 seem to have been populated correctly. My fields in the DB are product_size and product_name as per the error message. The error message also shows the values of the variables correctly (prodname=Tap Shoes and size1=2). Is it to do with the spaces in the variables? ie Tap Shoes?? Someone said it may be down to a problem with double quotes?
 

nemisys

Member
Joined
Dec 18, 2002
Location
Pennsylvania
Try adding ' around your variables. Like this:

sqlString = "SELECT * FROM Products "
sqlString = sqlString & "WHERE product_name='" & prodname & "'" & _
" AND product_size='" & size1 & "'"
 
OP
markodude

markodude

Member
Joined
Jul 15, 2002
Location
Europe
LOL I might have known you would end up helping nemi, hope you are well!
That was the problem indeed! Now onto the next bug, this one had just been holding me up all morning and I was endlessly changing the quotes to no avail, I should have done it properly!
Ive had a bit of a mare with this store, Ive customised the SAMS teach yourself E-commerce with asp front end to do what I need it to, but there was no size field for products and I have ended up having to rework it...
http://217.178.88.5/store if you wanna have a wee look!
Take it easy mate, thanks again
Marko

PS The products in here are a real (honestly its not a joke) :D
 

nemisys

Member
Joined
Dec 18, 2002
Location
Pennsylvania
np....
glad I could help...been a little out of touch as I have relocated from florida to pennsylvania...

My email has changed too. I will send to you through PM.