Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Location
    Hong Kong
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error In My Select Statement

    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
    Attached Files Attached Files

  • #2
    New Coder
    Join Date
    Nov 2003
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error In My Select Statement

    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..^^

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,037
    Thanks
    0
    Thanked 250 Times in 246 Posts
    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 )
    %>

  • #4
    Regular Coder
    Join Date
    Aug 2002
    Location
    Hong Kong
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks glenngv,
    It works.
    I think I am too careless about this.
    Thank You Very Much.
    Best Regards
    Victoria


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •