...

View Full Version : Error In My Select Statement



victoria_1018
11-24-2003, 02:24 AM
Hi,
I had some error in my SQL statement.
I had tried doing it in Access and a response .write, but not very sure why the statement don't work.
The following is my SQL statement where the error occurs.


<%'Get DHL Delivery Charges
sqlString = "SELECT users.user_id, users.user_country, DHLCharge.DHL_Country, DHLCharge.DHL_Price, DHLCharge.DHL_Weight" &_
"FROM users INNER JOIN DHLCharge ON users.user_country = DHLCharge.DHL_Country" &_
"WHERE users.user_id=" & userID & " " &_
"AND DHLCharge.DHL_Weight like "&weightTotal&" "
SET RS1 = Con.Execute( sqlString )
%>


The following is the error message

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'DHLCharge.DHL_WeightFROM users INNER JOIN DHLCharge ON users.user_country = DHLCharge.DHL_CountryWHERE users.user_id=15 AND DHLCharge.DHL_Weight like 5'.
/OnlineStore/ShoppingCart/Invoice.asp, line 162


I had also attached the full script together with this question.

My record set, RS and RS 1 is declare on another page as Invoice.asp is an attach file.

Thank You

larman
11-24-2003, 03:06 AM
In your code:
Maybe " & userID & " should be like ' " & userID & " ',and the same as other variables.
If it don't work,plz forgive me because i am a newbie.
I just try to help you..^^

glenngv
11-24-2003, 05:19 AM
You should put a space

'DHLCharge.DHL_WeightFROM users INNER JOIN DHLCharge ON users.user_country = DHLCharge.DHL_CountryWHERE users.user_id=15 AND DHLCharge.DHL_Weight like 5'

<%'Get DHL Delivery Charges
sqlString = "SELECT users.user_id, users.user_country, DHLCharge.DHL_Country, DHLCharge.DHL_Price, DHLCharge.DHL_Weight" &_
" FROM users INNER JOIN DHLCharge ON users.user_country = DHLCharge.DHL_Country" &_
" WHERE users.user_id=" & userID & _
" AND DHLCharge.DHL_Weight like "&weightTotal&" "
SET RS1 = Con.Execute( sqlString )
%>

victoria_1018
11-24-2003, 06:41 AM
Thanks glenngv,
It works.
I think I am too careless about this.
Thank You Very Much.
Best Regards
Victoria



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum