I've very new to ColdFusion and need some help. I've written a page that has
six fields: office, year, number, title, contact and phone number. The first
two are hidden fields have a value attached to them and the third changes. The
user enters the title, contact and phone number and then the data is entered
into a database. The two hidden fields are populated with no problems. For the
third field, number, a query is ran to find the highest number in that field
and then add one to it to get the next number. When an initial record is in
the database everything works perfect however, when the table is empty I get an
error message.
It says that it cannot convert " " to a number. I even put a cfset statement
in there to set the field to 1 but it isn't working. Any ideas?
Below is the query to find the highest number and the cfif statement to handle
the number.
<cfquery name="qryHighestNum" datasource="ocreodsn">
Select Max(ReqNum) as HighestNumber
from PrintingReq
</cfquery>
<cfif qryHighestNum.RecordCount is 0>
<cfset NextReqNumber = 1>
<cfelse>
<cfset NextReqNumber = #qryHighestNum.HighestNumber# + 1>
</cfif>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:268111
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4