a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Thousand Separator

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Thousand Separator
Page: [1]
 
adam2804

 

Posts: 34
Joined: 6/6/2006
Status: offline

 
Thousand Separator - 8/2/2006 9:51:47   
Hello,

Has anyone made use of thousand separators for numbers? I understand how to cast the number to MONEY to add thousand separators, however I'm left with two decimal places (e.g. .00) how can I trim this off?

Here's what I'm using at the moment:

CAST(CONVERT (VARCHAR, CAST(SUM(B.Sheets) AS MONEY), 1) AS VARCHAR)

Any improvements on this would be gratefully recieved.

Thanks,

Adam
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Thousand Separator - 8/2/2006 9:57:38   
Have you tried using the FormatNumber function when displaying?

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_da-db_2mic.asp

You may still want to use money but I normally use the GroupDigits part of the function to force commas.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to adam2804)
adam2804

 

Posts: 34
Joined: 6/6/2006
Status: offline

 
RE: Thousand Separator - 8/2/2006 11:41:54   
Thanks for the reply,

Did you mean that the number should be put through a FormatNumber function in FrontPage, through VB?

I take it you wouldn't recommend doing it dircetly in the query with about 5 CAST's, CONVERT's and TRIM's?

What was that GroupDigits part that you mentioned? How do you use that?

Thanks,

Adam

(in reply to rdouglass)
Spooky

 

Posts: 26617
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Thousand Separator - 8/2/2006 12:28:27   
Yes, use it when you output the asp
eg :
<%=FormatNumber(rs("money"))%>

http://www.w3schools.com/vbscript/func_formatnumber.asp

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to adam2804)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Thousand Separator - 8/3/2006 10:56:49   
quote:

What was that GroupDigits part that you mentioned? How do you use that?


All that was in the link I posted.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to Spooky)
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> Thousand Separator
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts