|
-
May 26th, 2001, 05:29 PM
#1
Thread Starter
Hyperactive Member
If the search was working I probably wouldn't have to ask this, but:
Hi,
Can a number be formatted in ASP?
I'm retreiving data from a data base and writing it to an HTML table. Some of the data is price information. I'm trying to get it to show up in the table as a price.
I've tried using the Format function in ASP but it's giving me an error. e.g.,
Code:
<%ItemPryc = Format(Cdbl(rs.fields(4).value),"$##0.00")%>
Thanks,
Al.
A computer is a tool, not a toy.
-
May 27th, 2001, 08:37 AM
#2
-
May 28th, 2001, 02:54 AM
#3
Frenzied Member
Well.. that was helpful..
The Format function is not available in VBScript. You must use the FormatCurrency, FormatDateTime, FormatNumber, FormatPercent functions.
I can't for the life of me figure out why MS left out this useful function, (Maybe because it is so slow) but they did.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
May 28th, 2001, 05:16 AM
#4
Thread Starter
Hyperactive Member
Thank you Monte96
Thanks. That's alot easier and sanitary then my work-around below.
Code:
<%
If Cint(ItemPryc)-Cdbl(ItemPryc)=0 then
ItemPryc=ItemPryc & ".00"
End If
If Len(ItemPryc)-Instr(ItemPryc,".")=1 then
ItemPryc=ItemPryc & "0"
End If
%>
Al.
A computer is a tool, not a toy.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|