FormatNumber with db results
FormatNumber with db results
am 21.04.2005 13:45:51 von Trym Bagger
Hi All:
The following was posted to microft.public.scripting.vbscript but nobody
replied there, so here goes:
How come that
<%
tt = 3
response.write tt & "
"
response.write FormatNumber(tt,2)
%>
returns:
3
3.00
but
<%
response.write FormatNumber(RS(0),2)
%>
returns:
3
when RS is a recordset from an Access database and the column in question
contains the value 3.
I would like the result to be "3.00"
The result is the same regardless of the number type that I choose for the
column (integer, double, single, whatever)
Any advice would be highly appreciated. Thanks.
TB
Re: FormatNumber with db results
am 21.04.2005 13:59:37 von Steven Burn
Dim lTemp
lTemp =3D rs("0")
Response.Write "Original: " & lTemp & "
"
Response.Write "Formatted: " & FormatNumber(lTemp, 2)
--=20
Regards
Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk
Keeping it FREE!
"TB" wrote in message =
news:eKBkoemRFHA.2604@TK2MSFTNGP10.phx.gbl...
> Hi All:
>=20
> The following was posted to microft.public.scripting.vbscript but =
nobody=20
> replied there, so here goes:
>=20
> How come that
>=20
> <%
> tt =3D 3
> response.write tt & "
"
> response.write FormatNumber(tt,2)
> %>
>=20
> returns:
>=20
> 3
> 3.00
>=20
> but
>=20
> <%
> response.write FormatNumber(RS(0),2)
> %>
>=20
> returns:
>=20
> 3
>=20
> when RS is a recordset from an Access database and the column in =
question
> contains the value 3.
> I would like the result to be "3.00"
>=20
> The result is the same regardless of the number type that I choose for =
the
> column (integer, double, single, whatever)
>=20
> Any advice would be highly appreciated. Thanks.
>=20
> TB=20
>=20
>=20
Re: FormatNumber with db results
am 21.04.2005 17:36:39 von Trym Bagger
Thanks. But a bit of a bother though, if I have to create a variable for
each data base value.
But it works. Thanks again.
TB
"Steven Burn" wrote in message
news:ekg%232mmRFHA.1176@TK2MSFTNGP12.phx.gbl...
Dim lTemp
lTemp = rs("0")
Response.Write "Original: " & lTemp & "
"
Response.Write "Formatted: " & FormatNumber(lTemp, 2)
--
Regards
Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk
Keeping it FREE!
"TB" wrote in message
news:eKBkoemRFHA.2604@TK2MSFTNGP10.phx.gbl...
> Hi All:
>
> The following was posted to microft.public.scripting.vbscript but nobody
> replied there, so here goes:
>
> How come that
>
> <%
> tt = 3
> response.write tt & "
"
> response.write FormatNumber(tt,2)
> %>
>
> returns:
>
> 3
> 3.00
>
> but
>
> <%
> response.write FormatNumber(RS(0),2)
> %>
>
> returns:
>
> 3
>
> when RS is a recordset from an Access database and the column in question
> contains the value 3.
> I would like the result to be "3.00"
>
> The result is the same regardless of the number type that I choose for the
> column (integer, double, single, whatever)
>
> Any advice would be highly appreciated. Thanks.
>
> TB
>
>
Re: FormatNumber with db results
am 21.04.2005 19:22:56 von reb01501
Or use a GetRows array ...
TB wrote:
> Thanks. But a bit of a bother though, if I have to create a variable
> for each data base value.
>
> But it works. Thanks again.
>
> TB
>
> "Steven Burn" wrote in message
> news:ekg%232mmRFHA.1176@TK2MSFTNGP12.phx.gbl...
> Dim lTemp
> lTemp = rs("0")
> Response.Write "Original: " & lTemp & "
"
> Response.Write "Formatted: " & FormatNumber(lTemp, 2)
>
> --
> Regards
>
> Steven Burn
> Ur I.T. Mate Group
> www.it-mate.co.uk
>
> Keeping it FREE!
>
> "TB" wrote in message
> news:eKBkoemRFHA.2604@TK2MSFTNGP10.phx.gbl...
>> Hi All:
>>
>> The following was posted to microft.public.scripting.vbscript but
>> nobody replied there, so here goes:
>>
>> How come that
>>
>> <%
>> tt = 3
>> response.write tt & "
"
>> response.write FormatNumber(tt,2)
>> %>
>>
>> returns:
>>
>> 3
>> 3.00
>>
>> but
>>
>> <%
>> response.write FormatNumber(RS(0),2)
>> %>
>>
>> returns:
>>
>> 3
>>
>> when RS is a recordset from an Access database and the column in
>> question contains the value 3.
>> I would like the result to be "3.00"
>>
>> The result is the same regardless of the number type that I choose
>> for the column (integer, double, single, whatever)
>>
>> Any advice would be highly appreciated. Thanks.
>>
>> TB
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Re: FormatNumber with db results
am 21.04.2005 20:17:08 von Trym Bagger
This where I have to do my homework: moving away from recordsets and into
GetRows arrays, which I know uses less resources.
Thanks
TB
"Bob Barrows [MVP]" wrote in message
news:eNJtDbpRFHA.4028@tk2msftngp13.phx.gbl...
> Or use a GetRows array ...
>
> TB wrote:
>> Thanks. But a bit of a bother though, if I have to create a variable
>> for each data base value.
>>
>> But it works. Thanks again.
>>
>> TB
>>
>> "Steven Burn" wrote in message
>> news:ekg%232mmRFHA.1176@TK2MSFTNGP12.phx.gbl...
>> Dim lTemp
>> lTemp = rs("0")
>> Response.Write "Original: " & lTemp & "
"
>> Response.Write "Formatted: " & FormatNumber(lTemp, 2)
>>
>> --
>> Regards
>>
>> Steven Burn
>> Ur I.T. Mate Group
>> www.it-mate.co.uk
>>
>> Keeping it FREE!
>>
>> "TB" wrote in message
>> news:eKBkoemRFHA.2604@TK2MSFTNGP10.phx.gbl...
>>> Hi All:
>>>
>>> The following was posted to microft.public.scripting.vbscript but
>>> nobody replied there, so here goes:
>>>
>>> How come that
>>>
>>> <%
>>> tt = 3
>>> response.write tt & "
"
>>> response.write FormatNumber(tt,2)
>>> %>
>>>
>>> returns:
>>>
>>> 3
>>> 3.00
>>>
>>> but
>>>
>>> <%
>>> response.write FormatNumber(RS(0),2)
>>> %>
>>>
>>> returns:
>>>
>>> 3
>>>
>>> when RS is a recordset from an Access database and the column in
>>> question contains the value 3.
>>> I would like the result to be "3.00"
>>>
>>> The result is the same regardless of the number type that I choose
>>> for the column (integer, double, single, whatever)
>>>
>>> Any advice would be highly appreciated. Thanks.
>>>
>>> TB
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
Re: FormatNumber with db results
am 21.04.2005 20:52:11 von reb01501
http://www.aspfaq.com/show.asp?id=2467
TB wrote:
> This where I have to do my homework: moving away from recordsets and
> into GetRows arrays, which I know uses less resources.
>
> Thanks
>
> TB
>
> "Bob Barrows [MVP]" wrote in message
> news:eNJtDbpRFHA.4028@tk2msftngp13.phx.gbl...
>> Or use a GetRows array ...
>>
>> TB wrote:
>>> Thanks. But a bit of a bother though, if I have to create a variable
>>> for each data base value.
>>>
>>> But it works. Thanks again.
>>>
>>> TB
>>>
>>> "Steven Burn" wrote in message
>>> news:ekg%232mmRFHA.1176@TK2MSFTNGP12.phx.gbl...
>>> Dim lTemp
>>> lTemp = rs("0")
>>> Response.Write "Original: " & lTemp & "
"
>>> Response.Write "Formatted: " & FormatNumber(lTemp, 2)
>>>
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Re: FormatNumber with db results
am 22.04.2005 02:32:35 von Bob Lehmann
> But a bit of a bother though
So apparently, having it not work the way you want it to is more desirable?
Bob Lehmann
"TB" wrote in message
news:OsNHmfoRFHA.356@TK2MSFTNGP14.phx.gbl...
> Thanks. But a bit of a bother though, if I have to create a variable for
> each data base value.
>
> But it works. Thanks again.
>
> TB
>
> "Steven Burn" wrote in message
> news:ekg%232mmRFHA.1176@TK2MSFTNGP12.phx.gbl...
> Dim lTemp
> lTemp = rs("0")
> Response.Write "Original: " & lTemp & "
"
> Response.Write "Formatted: " & FormatNumber(lTemp, 2)
>
> --
> Regards
>
> Steven Burn
> Ur I.T. Mate Group
> www.it-mate.co.uk
>
> Keeping it FREE!
>
> "TB" wrote in message
> news:eKBkoemRFHA.2604@TK2MSFTNGP10.phx.gbl...
> > Hi All:
> >
> > The following was posted to microft.public.scripting.vbscript but nobody
> > replied there, so here goes:
> >
> > How come that
> >
> > <%
> > tt = 3
> > response.write tt & "
"
> > response.write FormatNumber(tt,2)
> > %>
> >
> > returns:
> >
> > 3
> > 3.00
> >
> > but
> >
> > <%
> > response.write FormatNumber(RS(0),2)
> > %>
> >
> > returns:
> >
> > 3
> >
> > when RS is a recordset from an Access database and the column in
question
> > contains the value 3.
> > I would like the result to be "3.00"
> >
> > The result is the same regardless of the number type that I choose for
the
> > column (integer, double, single, whatever)
> >
> > Any advice would be highly appreciated. Thanks.
> >
> > TB
> >
> >
>
>
Re: FormatNumber with db results
am 23.04.2005 01:03:46 von Trym Bagger
I didn't say that. But I have resolved to learn the getrows() method.
TB
"Bob Lehmann" wrote in message
news:eJY20KtRFHA.3988@tk2msftngp13.phx.gbl...
>> But a bit of a bother though
> So apparently, having it not work the way you want it to is more
> desirable?
>
> Bob Lehmann
>
> "TB" wrote in message
> news:OsNHmfoRFHA.356@TK2MSFTNGP14.phx.gbl...
>> Thanks. But a bit of a bother though, if I have to create a variable for
>> each data base value.
>>
>> But it works. Thanks again.
>>
>> TB
>>
>> "Steven Burn" wrote in message
>> news:ekg%232mmRFHA.1176@TK2MSFTNGP12.phx.gbl...
>> Dim lTemp
>> lTemp = rs("0")
>> Response.Write "Original: " & lTemp & "
"
>> Response.Write "Formatted: " & FormatNumber(lTemp, 2)
>>
>> --
>> Regards
>>
>> Steven Burn
>> Ur I.T. Mate Group
>> www.it-mate.co.uk
>>
>> Keeping it FREE!
>>
>> "TB" wrote in message
>> news:eKBkoemRFHA.2604@TK2MSFTNGP10.phx.gbl...
>> > Hi All:
>> >
>> > The following was posted to microft.public.scripting.vbscript but
>> > nobody
>> > replied there, so here goes:
>> >
>> > How come that
>> >
>> > <%
>> > tt = 3
>> > response.write tt & "
"
>> > response.write FormatNumber(tt,2)
>> > %>
>> >
>> > returns:
>> >
>> > 3
>> > 3.00
>> >
>> > but
>> >
>> > <%
>> > response.write FormatNumber(RS(0),2)
>> > %>
>> >
>> > returns:
>> >
>> > 3
>> >
>> > when RS is a recordset from an Access database and the column in
> question
>> > contains the value 3.
>> > I would like the result to be "3.00"
>> >
>> > The result is the same regardless of the number type that I choose for
> the
>> > column (integer, double, single, whatever)
>> >
>> > Any advice would be highly appreciated. Thanks.
>> >
>> > TB
>> >
>> >
>>
>>
>
>