•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ColdFusion section within the Web Development category of DaniWeb, a massive community of 375,170 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,204 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ColdFusion advertiser:
Views: 4344 | Replies: 2
![]() |
•
•
Join Date: Aug 2004
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Hello,
experts out there. First of all, thanks for reading my threads.
I am a junior developer using ColdFusion. I have some doubts here.
When we passing the parameters which is numeric type, then use that variable in another page for query, sometimes will come out with error of CF_SQL_NUMERIC, even we just #trim(variable)#.
When i meet such problem, i always #val(variable)# in order to get back the numeric value. It works if the variable when i have full confidence the variable is a numeric type. But is this the proper way to fix this?? Or anyone can tell me the correct way and the impact by #val()# the variable??
Thanks for help. :mrgreen:
experts out there. First of all, thanks for reading my threads.I am a junior developer using ColdFusion. I have some doubts here.
When we passing the parameters which is numeric type, then use that variable in another page for query, sometimes will come out with error of CF_SQL_NUMERIC, even we just #trim(variable)#.
When i meet such problem, i always #val(variable)# in order to get back the numeric value. It works if the variable when i have full confidence the variable is a numeric type. But is this the proper way to fix this?? Or anyone can tell me the correct way and the impact by #val()# the variable??
Thanks for help. :mrgreen:
Hi mayoline
Trim() will only remove the leading and trailing spaces. It wont convert string to a number.
Val() will convert those characters in the beginning of a string which can be converted to a number.
Val always returns a number. Even if the conversion fails it will return 0.
Use val() whereever you want strictly numeric values (like in calculations)
In those cases where you strictly need a non-zero number, check if the value returned by val() is 0 or not and then proceed.
-Ramesh
Trim() will only remove the leading and trailing spaces. It wont convert string to a number.
Val() will convert those characters in the beginning of a string which can be converted to a number.
Val always returns a number. Even if the conversion fails it will return 0.
Use val() whereever you want strictly numeric values (like in calculations)
In those cases where you strictly need a non-zero number, check if the value returned by val() is 0 or not and then proceed.
-Ramesh
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb ColdFusion Marketplace
- Graduate Developer needed in UK Gaming Company (Web Development Job Offers)
- FT Junior Java Developer Needed for Major Media firm in NYC (Software Development Job Offers)
- Web Developer (PHP) - Northern NJ (Web Development Job Offers)
- Pls Help vb $ excell “Couldn't find installable ISAM� error. (Community Introductions)
- Pls Help vb $ excell “Couldn't find installable ISAM� error. (Community Introductions)
- Close all active mssql server connections from vb.net (VB.NET)
- Newbie Wants Answers........ (IT Careers and Business)
Other Threads in the ColdFusion Forum
- Previous Thread: ValueList function in ColdFusion Report?
- Next Thread: New free crossplattform ColdFusion Engine


Linear Mode