yor query will always return a row and as such the test will fail even if
the return item is null

replace with this:
<cfset SESSION.ecom.ordernumber=val(qLastOrderNo.newOrderNumber) + 1>

plus the lock if you are on cf < mx
Marius Milosav
www.scorpiosoft.com
It's not about technology, it's about people.
Virtual Company (VICO) Application Demo
www.scorpiosoft.com/vicodemo/login.cfm


----- Original Message -----
From: "Mark Leder" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, February 05, 2003 3:48 PM
Subject: Convert format


> Hi All,
> I've got a query which retrieves the max order number from the db.
> I want to increment it by one and write the new number to a session var.
> However, CF5 throws a message that it can't convert format. I checked the
db
> (SQL 2000)- the field ordernumber is an integer.
>
> What am I doing wrong? (here's the snip)
> ------------------------------------
>
> <!--- Create an order number --->
> <!--- Query the orders database for the last order number --->
> <cfquery name="qLastOrderNo" dbtype="dynamic"
> connectstring="#REQUEST.dsnStore#">
> SELECT MAX(ordernumber) AS newOrderNumber
> FROM #REQUEST.tablePrefix#_O_OrderInfo
> </cfquery>
>
>  <cflock name="VASPCart#SESSION.SessionID#" timeout="10" type="exclusive">
> <cfif qLastOrderNo.recordcount IS "0">
> <cfset SESSION.ecom.ordernumber="7500">
> <cfelse>
> <cfset SESSION.ecom.ordernumber=
> #qLastOrderNo.newOrderNumber# + 1>
> </cfif>
> </cflock>
>
> ------------------------------------
>
> Thanks, Mark
>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to