943,568 Members | Top Members by Rank

Ad:
  • ColdFusion Discussion Thread
  • Unsolved
  • Views: 5547
  • ColdFusion RSS
Aug 3rd, 2004
0

Junior Developer have some doubts in CF_SQL_NUMERIC

Expand Post »
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:
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mayoline is offline Offline
2 posts
since Aug 2004
Nov 3rd, 2006
0

Re: Junior Developer have some doubts in CF_SQL_NUMERIC

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rameshsambu is offline Offline
8 posts
since Oct 2006
Nov 6th, 2006
0

Re: Junior Developer have some doubts in CF_SQL_NUMERIC

Thanks for your reply.

Reputation Points: 10
Solved Threads: 0
Newbie Poster
mayoline is offline Offline
2 posts
since Aug 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ColdFusion Forum Timeline: ValueList function in ColdFusion Report?
Next Thread in ColdFusion Forum Timeline: New free crossplattform ColdFusion Engine





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC