I think I understand now.

The cfcatch is not being 'tripped' because the database query is not
failing.  A result of 'no results' is not a database 'failure' but a good,
solid, return from the query.

<cfquery name="eqptid" datasource="#datamain#">
                select eqptid from eqpt where serialno='#form.txtSerial#' 
     </cfquery>
As long as 'serialno' is a non-numeric field, then any value for
form.txtSerial (even 'blank') is valid.
<cfcatch> only reacts to bad returns from the database such as searching for
a string in a numeric field, mismatched fields, etc.

Try something like this:
<cfif isDefined("FORM.Submit") >

<cftry>
        <cfquery name="eqptid" datasource="#datamain#">
                select eqptid from eqpt where serialno='#form.txtSerial#'
            
     </cfquery>
       <cfcatch type="Database">
        <strong>There was a problem with the search, please try
again.</strong>
                <cfabort>
       </cfcatch>
</cftry>
<cfif eqptid.recordcount eq 0>
        
                <strong>The serial number entered was not found in the
database. Please click the back button on the browser and try again.
</strong>
                <strong> <br /> If this is your second attmept please send
all information to Sam Garcia. I will enter all information
manually.</strong>
                </cfif>
------------------
William E. Seiter
 
Need to have your mortgage modified?  
I charge no fees until I am successful, 
then I charge almost half the rate you 
would find elsewhere.
Professional. Dedicated. Effective.
The Easy 24/7 way to get started: http://www.goldengrove.net/
or you can call: (626) 593 - 5501



William 
Thanks for taking time to reply. After much reading last night, I believe I
know the problem just not how to correct. When I enter a valid value
everything runs fine. When I enter an invalid value I need to handle this
exception. I think my query is returning a NULL value when an invalid value
is entered on the form. There is no way to check this value on the form. See
the users are updating a database and the serial number may not be in the
database or simply entered incorrectly therefore the query returns a NULL
value. I am forced to use an older version of ColdFusion 5.0 so I can not
use isNULL() I am leaning toward using javascript to check for a NULL value.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4440
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to