<CFQUERY NAME="movies" DATASOURCE="ows">
Can anyone explain?????
"Error Diagnostic Information
ODBC Error Code = 37000 (Syntax error or access violation)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'MovieTitle LIKE '%a%' WHERE PitchText LIKE '%a%' WHERE RatingID = 3'.
The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (9:2) to (9:41)."
The Results page query looks like this ....
<CFQUERY NAME="movies" DATASOURCE="ows">
SELECT MovieTitle, PitchText, Summary, DateInTheaters
FROM Films
<!--- Search by Movie Title --->
<CFIF FORM.MovieTitle IS NOT " ">
WHERE MovieTitle LIKE '%#MovieTitle#%'
</CFIF>
<!--- Search by Pitch Text --->
<CFIF FORM.PitchText IS NOT " ">
WHERE PitchText LIKE '%#FORM.PitchText#%'
</CFIF>
<!--- Search by Rating ID --->
<CFIF FORM.RatingID IS NOT " ">
WHERE RatingID = #FORM.RatingID#
</CFIF>
ORDER BY MovieTitle
</CFQUERY>
You are only allowed one WHERE clause (so simple yet I over looked it 50 times).
This is the code I ended up with. This is one solution, altough I'd be interested to hear if anyone has an alternative (cleaner) way to get these results.
<CFQUERY NAME="movies" DATASOURCE="ows">
SELECT MovieTitle, PitchText, Summary, DateInTheaters
FROM Films
WHERE 0=0
<!--- Search by Movie Title --->
<CFIF FORM.MovieTitle IS NOT " ">
AND MovieTitle LIKE '%#MovieTitle#%'
</CFIF>
<!--- Search by Pitch Text --->
<CFIF FORM.PitchText IS NOT " ">
AND PitchText LIKE '%#FORM.PitchText#%'
</CFIF>
<!--- Search by Rating ID --->
<CFIF FORM.RatingID IS NOT " ">
AND RatingID = #FORM.RatingID#
</CFIF>
ORDER BY MovieTitle
</CFQUERY>