views:

52

answers:

3

I have a text field who's value is populated from a SQL recordset (below).

<input name="txtAmount" id="txtAmount" type="text" size="10" maxlength="10" value="<%=RS("Amount")%>">

In the SQL table, the Amount field (which is a money data type) is inserted correctly, as 5.00 However, in the web page, it displays only as 5 (i.e. the decimal places are missing). Anyone know why this might be and how I can get the decimal places to display in the field? Thanks!

A: 

If your code is in .NET, you can use

<%= String.Format("{0:0.00}", RS("Amount")) %>
Amry
i'm actually using classic ASP. is there an equivalent to String.Format for that?
baldwingrand
+1  A: 

Applying formating will do the trick:

<input name="txtAmount" id="txtAmount" type="text" size="10" maxlength="10" 
       value="<%=FormatCurrency(RS("Amount"), 2)%>">
Eduardo Molteni
+1  A: 

If you don't want the dollar sign, use

value="<%=FormatNumber(RS("Amount"),2)%>"
Kosta