www.webdeveloper.com
Results 1 to 3 of 3

Thread: why do i get this syntax error???

  1. #1
    Join Date
    Apr 2006
    Location
    Oslo, Norway
    Posts
    95

    why do i get this syntax error???

    i have a link on page1 that looks like this:
    Code:
    <a href="page2.asp?ID=<% Response.write(oRes01.Fields.Item("ID").Value)%>"><% Response.write(oRes01("description")) %></a>
    on page2.asp i have this code:
    Code:
    Set oRes01 = Conn.Execute("SELECT * FROM product WHERE ID = " + Replace(rs_oRes01__ColParam, "'", "''") + " ")
    this gives me an error:
    Syntax error (missing operator) in query expression 'ID ='.

    what i want is to get the ID number from page1.asp to get in the ID number in the SQL query on page2.asp


    anybody know why i get this error?
    what does this code really do:
    + Replace(rs_oRes01__ColParam, "'", "''") + " ")

  2. #2
    Join Date
    Nov 2003
    Location
    Worthington, OH, USA
    Posts
    3,634
    Off the top of my head it looks like
    Code:
     
    Replace(rs_oRes01__ColParam, "'", "''")
    may be returning null or spaces thus yielding an incomplete select.
    54 68 65 42 65 61 72 4D 61 79

  3. #3
    Join Date
    Feb 2006
    Location
    Continental USA
    Posts
    68
    Code:
    Set oRes01 = Conn.Execute("SELECT * FROM product WHERE ID = " + Replace(rs_oRes01__ColParam, "'", "''") + " ")
    in vbscript + is used for addition and not concatenation. change it to this and see if it works.

    Code:
    Set oRes01 = Conn.Execute("SELECT * FROM product WHERE ID = " & Replace(rs_oRes01__ColParam, "'", "''") & " ")
    Master Shake
    Master Shake
    Question: Lived here all your life? Answer: No, not yet!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles