Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > formating number

Reply
Thread Tools

formating number

 
 
Jeff
Guest
Posts: n/a
 
      11-09-2006
hey guys

If i wish to show a decimal on a number, i can do this

v2_score = formatnumber(v2_score1, 0)

but how would i only show the 2 decimal places IF there is an actual
remainder after the division?

here is the script and stuff
using sql db server

v2_score1 = v_score / v_played
v2_score = formatnumber(v2_score1, 0)

v_score is an over all total in the db
v_played is how many matches were played.

any help please.... and thank you??


 
Reply With Quote
 
 
 
 
MadMike42
Guest
Posts: n/a
 
      11-10-2006
Use the MOD function,
this will return the numbers after the point

example
a) 42/100 = 0.42
b) 42 mod 100 = 42

SO if you have a result to the MOD sum, you can show
with the formatting, if no result, you can show with out the formatting

Mike.

"Jeff" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ...
> hey guys
>
> If i wish to show a decimal on a number, i can do this
>
> v2_score = formatnumber(v2_score1, 0)
>
> but how would i only show the 2 decimal places IF there is an actual
> remainder after the division?
>
> here is the script and stuff
> using sql db server
>
> v2_score1 = v_score / v_played
> v2_score = formatnumber(v2_score1, 0)
>
> v_score is an over all total in the db
> v_played is how many matches were played.
>
> any help please.... and thank you??
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OT: Number Nine, Number Nine, Number Nine FrisbeeŽ MCSE 37 09-26-2005 04:06 PM
splitting seconds into Hr, Min and Sec, and formating number Robocop Java 3 02-26-2004 09:23 PM
number formating! Jamie Fryatt ASP General 2 02-10-2004 02:02 PM
Formating text Dmitri Manushin ASP .Net 0 08-14-2003 02:34 PM
automatic code formating... rodrigo guerra ASP .Net 0 07-05-2003 06:46 AM



Advertisments