Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: select query error


Message #1 by "Dai" <david@d...> on Fri, 7 Mar 2003 21:05:53
I'm new to asp so any help would be appreciated. I'm getting the following 
error message in my select query and I haven't the foggiest what is 
missing or how to put it right.


Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) 
in query expression '* review1 WHERE country_name = ' Mexico ' AND WHERE 
resort_name = ' Porta Vallarta ' AND WHERE accom_type = ' all inclusive ' 
AND WHERE accom_name = ' Tropical ''.


This is the SQL statement:

Dim Sql
Sql = "SELECT * review1 WHERE country_name = ' " & _
         Request.Form("country") & " ' AND  WHERE resort_name = ' " & _
         Request.Form("resort") & " ' AND WHERE accom_type = ' " & _
         Request.Form("accomodation_type") & " ' AND WHERE accom_name 
= ' " & _
         Request.Form("accomodation") & " ' "


Thanks in advance 

Dai
Message #2 by "Zee Computer Consulting" <zee@t...> on Fri, 7 Mar 2003 17:30:33 -0800
1) You are missing the FROM keyword;
2) Use the keyword WHERE only once;
3) Don't accidently put spaces around form fields;
4) Space and line up your program lines for symmetry and ease of
proofreading;

strSQL = " " _
& SELECT * FROM Review1 " _
& " WHERE country_name='" & Request.Form("country") & "'" _
& "      AND resort_name='" & Request.Form("resort") & "'" _
& "      AND accom_type='" & Request.Form("accomodation_type") & "'" _
& "      AND accom_name='" & Request.Form("accomodation") & "'"


-- Zee



----- Original Message -----
From: "Dai" <david@d...>
To: "Access ASP" <access_asp@p...>
Sent: Friday, March 07, 2003 9:05 PM
Subject: [access_asp] select query error


> I'm new to asp so any help would be appreciated. I'm getting the following
> error message in my select query and I haven't the foggiest what is
> missing or how to put it right.
>
>
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator)
> in query expression '* review1 WHERE country_name = ' Mexico ' AND WHERE
> resort_name = ' Porta Vallarta ' AND WHERE accom_type = ' all inclusive '
> AND WHERE accom_name = ' Tropical ''.
>
>
> This is the SQL statement:
>
> Dim Sql
> Sql = "SELECT * review1 WHERE country_name = ' " & _
>          Request.Form("country") & " ' AND  WHERE resort_name = ' " & _
>          Request.Form("resort") & " ' AND WHERE accom_type = ' " & _
>          Request.Form("accomodation_type") & " ' AND WHERE accom_name
> = ' " & _
>          Request.Form("accomodation") & " ' "
>
>
> Thanks in advance
>
> Dai
>


Message #3 by "Dai" <david@d...> on Sat, 8 Mar 2003 09:59:22
Thanks for the advice it is most appreciated. I will try your suggestions 
thanks.

Dai




> 1) You are missing the FROM keyword;
2) Use the keyword WHERE only once;
3) Don't accidently put spaces around form fields;
4) Space and line up your program lines for symmetry and ease of
proofreading;

strSQL = " " _
& SELECT * FROM Review1 " _
& " WHERE country_name='" & Request.Form("country") & "'" _
& "      AND resort_name='" & Request.Form("resort") & "'" _
& "      AND accom_type='" & Request.Form("accomodation_type") & "'" _
& "      AND accom_name='" & Request.Form("accomodation") & "'"


-- Zee



----- Original Message -----
From: "Dai" <david@d...>
To: "Access ASP" <access_asp@p...>
Sent: Friday, March 07, 2003 9:05 PM
Subject: [access_asp] select query error


> I'm new to asp so any help would be appreciated. I'm getting the 
following
> error message in my select query and I haven't the foggiest what is
> missing or how to put it right.
>
>
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator)
> in query expression '* review1 WHERE country_name = ' Mexico ' AND WHERE
> resort_name = ' Porta Vallarta ' AND WHERE accom_type = ' all inclusive '
> AND WHERE accom_name = ' Tropical ''.
>
>
> This is the SQL statement:
>
> Dim Sql
> Sql = "SELECT * review1 WHERE country_name = ' " & _
>          Request.Form("country") & " ' AND  WHERE resort_name = ' " & _
>          Request.Form("resort") & " ' AND WHERE accom_type = ' " & _
>          Request.Form("accomodation_type") & " ' AND WHERE accom_name
> = ' " & _
>          Request.Form("accomodation") & " ' "
>
>
> Thanks in advance
>
> Dai
>



  Return to Index