alexfusion
Programmer
Hi everyone:
I hope this question will be clear:
I have a search form with an action page that is a new fom.This last form will insert the content of the form fields into a Table.That is fine.
The possibles values entered by the visitor in the search form can be alphanumeric or numeric.
The problem is that in the query I compare the value entered for the visitor with the Id (autonumeric) field of the table,so if the visitor enter an alphanumeric value ,I get an error.Here I put some code to be more specific:
<cfquery name="check_values" datasource="datasourcename" dbtype="ODBC">
SELECT * FROM Table 1
WHERE customer_name= '#FORM.value#' OR phone='#FORM.value#' OR Id=#FORM.value#
</cfquery>
As you see if the visitor enter a value in the form that is not numeric,let's say 1A the criteria Id=#FORM.value# get this error:
ODBC Error Code = 37000 (Syntax error or access violation)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'customer_name='1A' OR phone='1A' OR Id=1A'.
How can I solve this error.I need to use the Id field as autonumeric value.
I hope I was clear.
Any help is welcome!!
alexfusion
mixale@hotmail.com
I hope this question will be clear:
I have a search form with an action page that is a new fom.This last form will insert the content of the form fields into a Table.That is fine.
The possibles values entered by the visitor in the search form can be alphanumeric or numeric.
The problem is that in the query I compare the value entered for the visitor with the Id (autonumeric) field of the table,so if the visitor enter an alphanumeric value ,I get an error.Here I put some code to be more specific:
<cfquery name="check_values" datasource="datasourcename" dbtype="ODBC">
SELECT * FROM Table 1
WHERE customer_name= '#FORM.value#' OR phone='#FORM.value#' OR Id=#FORM.value#
</cfquery>
As you see if the visitor enter a value in the form that is not numeric,let's say 1A the criteria Id=#FORM.value# get this error:
ODBC Error Code = 37000 (Syntax error or access violation)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'customer_name='1A' OR phone='1A' OR Id=1A'.
How can I solve this error.I need to use the Id field as autonumeric value.
I hope I was clear.
Any help is welcome!!
alexfusion
mixale@hotmail.com