Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Reading #s from Database
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Reading #s from Database

 Post Reply Post Reply
Author
zMaestro View Drop Down
Senior Member
Senior Member


Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
Post Options Post Options   Thanks (0) Thanks(0)   Quote zMaestro Quote  Post ReplyReply Direct Link To This Post Topic: Reading #s from Database
    Posted: 11 May 2003 at 2:16pm

Need Help....

I made a database which has a field for population, and all in millions.
The Field is a Number Field, population for a country for example is written like: 69387594.

I want to read it from the webpage as: 69,387,594

How can I put the comma (,) number format?.

Thanks. 



Edited by zMaestro
Back to Top
zMaestro View Drop Down
Senior Member
Senior Member


Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
Post Options Post Options   Thanks (0) Thanks(0)   Quote zMaestro Quote  Post ReplyReply Direct Link To This Post Posted: 11 May 2003 at 3:40pm

I changed the format of the Field in the Access Database to Standard, it worked in the access database, but didn't work from the webpages, it is still 69387594.

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 11 May 2003 at 6:17pm

You can use Formatnumber function in asp in your case:
FormatNumber(yournumber , 0 , TriStateFalse, TriStateFalse, TriStateTrue)

What that means:
FormatNumber(variable, number_of_decimals , LeadinZero, UseBracketsInseadOfMinusSign, ShowCommaForThousands)

The Tristate Values can be :
TristateTrue, TristateFalse, TristateUseDefault

Back to Top
zMaestro View Drop Down
Senior Member
Senior Member


Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
Post Options Post Options   Thanks (0) Thanks(0)   Quote zMaestro Quote  Post ReplyReply Direct Link To This Post Posted: 12 May 2003 at 3:30am

I got this error:

Error Type:
Microsoft VBScript runtime (0x800A0005)
Invalid procedure call or argument: 'FormatNumber'


I call the number from the database through rs(Col1) and it works fine, and number appears but unformated.

I changed <%= rs(Col1)%> by <%= FormatNumber(rs(Col1), 0, 0, 0, 1)%> and refreshed the page, and this error appeared.

Am I writing it wrong?

Thanks.

Back to Top
zMaestro View Drop Down
Senior Member
Senior Member


Joined: 11 May 2003
Location: Egypt
Status: Offline
Points: 1183
Post Options Post Options   Thanks (0) Thanks(0)   Quote zMaestro Quote  Post ReplyReply Direct Link To This Post Posted: 12 May 2003 at 5:19am

I tried something else.. and it worked.

I just wrote:
FormatNumber(r(
Col1), 0)

and the number appeared like: 69,387,594

Thanks...

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.