get rid of the quotes. And maybe you should trim the value before so you don't trim it twice, one in the if statement an dthe second one when you insert.
<cfset hourlyWage = trim(form.HourlyWage)> <cfif len(hourlyWage)>#numberFormat(hourlyWage,"999.99")#<cfelse>NULL</cfif> 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: "Venable, John" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Saturday, June 14, 2003 3:00 PM Subject: Money Datatype Problem > Maybe someone can tell me what I'm doing wrong. I have a field in SQL Server > 2K that is money datatype. I am building a submission form to populate that > field and I keep getting errors about type. This is what my field insert > looks like: > > <cfif > len(trim(form.HourlyWage))>'#trim(numberFormat(form.HourlyWage,"999.99"))#'< > cfelse>NULL</cfif> > > Which throws this error: > > Disallowed implicit conversion from data type varchar to data type money, > table 'JobTech.dbo.Enrollments', column 'HourlyWage'. Use the CONVERT > function to run this query. > > Even though in debugging, the value is 10.00 which seems pretty money-like > to me. > > SO I tried this: > > <cfif > len(trim(form.HourlyWageBefore))>'CONVERT(money,#trim(numberFormat(form.Hour > lyWageBefore,"999.99"))#)'<cfelse>NULL</cfif> > > Same error. Then I tried this: > > <cfif > len(trim(form.HourlyWageBefore))>'cast(#trim(numberFormat(form.HourlyWageBef > ore,"999.99"))# AS MONEY)'<cfelse>NULL</cfif> > > Same error. > > What am I doing wrong? I thought CF was typeless. > > Thanks > > John Venable > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4