Print Page | Close Window

Reading #s from Database

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=2607
Printed Date: 29 March 2026 at 6:02am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Reading #s from Database
Posted By: zMaestro
Subject: Reading #s from Database
Date 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. 




Replies:
Posted By: zMaestro
Date 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.



Posted By: michael
Date 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



-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: zMaestro
Date 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.



Posted By: zMaestro
Date 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...




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net