SQL Syntax error

Results 1 to 3 of 3

Thread: SQL Syntax error

  1. #1
    Oscar M Guest

    Default SQL Syntax error

    Hi,<BR><BR>I am using the following sql statement to find information about a particular record base on its ID.<BR><BR>SQL = "SELECT HomeListings.ID, HomeListings.* FROM HomeListings WHERE (HomeListings.ID=" & Request.QueryString("ID") & ");"<BR><BR>When executing the asp page I get the following error message:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e14&#039 <BR><BR>[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression &#039(HomeListings.ID=AF8A5FD4-9F9D-450F-9A31-C3175E287CC3})&#039. <BR><BR>/editlisting.asp, line 35 <BR><BR>Line 35 in my code is: RecordSet.Open cmdDC, , 0, 2<BR><BR>I cannot figure why the { is missing from the expression. If a do a response.write SQL, I get:<BR><BR>SELECT HomeListings.ID, HomeListings.* FROM HomeListings WHERE (HomeListings.ID={AF8A5FD4-9F9D-450F-9A31-C3175E287CC3}); <BR><BR>Any ideas of what I am doing wrong?<BR><BR>Thanks in advance for the help.<BR><BR>Oscar

  2. #2
    Paul M Guest

    Default RE: SQL Syntax error

    try changing the SQL to:<BR>SQL = "SELECT HomeListings.ID, HomeListings.* FROM HomeListings WHERE HomeListings.ID=&#039" & Request.QueryString("ID") & "&#039 "<BR><BR>Paul<BR><BR><BR>

  3. #3
    Oscar M Guest

    Default RE: Thanks

    Hello Paul,<BR><BR>Thank you very much for your help. The sql statement that you gave me work like a charm.<BR><BR>I though that a ; was required at the end of a sql statement. Any ideas?<BR><BR>Thanks again for your help.<BR><BR>Regards,<BR><BR>Oscar

Posting Permissions

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