At 10:04 PM 2/14/2006, Charlie Griefer you wrote:
> > - if there are only spaces, it throws an error;
> > - if there is text (e.g., "n/a"), it throws an error.
>
>"it" throws an error? what is "it"? the regex? the query? what
>is the error?
If I type a space or text in the numeric input field calle "hsGPA", I get this:
Error Executing Database Query.
[MERANT][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC
Microsoft Access Driver] Syntax error in UPDATE statement.
SQL UPDATE verifiedAppl_tb SET applLevel= 'Undergraduate' , hsGPA
= , collGRE = 840 WHERE applicationID= 1
The UPDATE code looks like this:
UPDATE verifiedAppl_tb SET applLevel=
<cfif IsDefined("FORM.applLevel") AND #FORM.applLevel# NEQ "">
'#FORM.applLevel#'
<cfelse>
NULL
</cfif>
, hsGPA =
<cfif IsDefined("FORM.hsGPA") AND #FORM.hsGPA# NEQ "">
#rereplace(FORM.hsGPA, '[^0-9/.]', '', 'all')#
<cfelse>
NULL
</cfif>
, collGRE =
<cfif IsDefined("FORM.collGRE") AND #FORM.collGRE# NEQ "">
#FORM.collGRE#
<cfelse>
NULL
</cfif>
WHERE applicationID= #applID#
What I'm thinking is that the CFIF that should enter the NULL value
is not being triggered, and the hsGPA field gets an empty record, and
the DB does not like that. What about processing the REREPLACE
outside of the query, assign the resulting string to a variable, and
then checking against that variable? In that case, if the variable is
empty, the CFIF will trigger the NULL option.
Roberto
>--
>Charlie Griefer
>
>================================================
>"...All the world shall be your enemy, Prince with a Thousand Enemies,
>and whenever they catch you, they will kill you. But first they must catch
>you, digger, listener, runner, prince with a swift warning.
>Be cunning and full of tricks and your people shall never be destroyed."
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232318
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54