472,146 Members | 1,419 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

VBscript FormatPercent overflow 800a0006

I am stumped. I have several websites running on a 2003 IIS6 box, all
running basically the same code (each site has its own home directory
and copy of the code). All are running in the same App Pool.

One site gives the 800a0006 error on a formatpercent, another site (on
the same server) does not.

Here's the kicker...the one site only fails if the number is LESS THAN
1.

formatpercent(0.999) ---overflow
formatpercent(1.000) ---100%

The one "abnormality" is that the default script language is set to
jscript, and I call the function via a call to a vbscript block -- but
this works on several other sites on this same server.

Any clues?

Sep 17 '06 #1
7 5665
Follow-up on previous post.

I have narrowed it down to the fact that I call the vbscript code from
jscript code, and anything with a decimal in the number fails.

Changing the default page language to vbscript and calling
formatpercent directly works fine for any number.

What is most peculiar (not to mention *extremely* frustrating) is that
this same code on another site on the same server works fine. I've
deleted/recreated the web app in IIS as well.

<%@language=jscript%>

<script language=vbscript runat=server>
function frmtPercent (nNumber)
fmrtPercent = formatpercent(nNumber,2)
end function
</script>

<%
frmtPercent(0) --0.00%
frmtPercent(1) --100.00%
fmrtPercent(0.5) --overflow 800a0006
%>

Please help....
wrote:
I am stumped. I have several websites running on a 2003 IIS6 box, all
running basically the same code (each site has its own home directory
and copy of the code). All are running in the same App Pool.

One site gives the 800a0006 error on a formatpercent, another site (on
the same server) does not.

Here's the kicker...the one site only fails if the number is LESS THAN
1.

formatpercent(0.999) ---overflow
formatpercent(1.000) ---100%

The one "abnormality" is that the default script language is set to
jscript, and I call the function via a call to a vbscript block -- but
this works on several other sites on this same server.

Any clues?
Sep 18 '06 #2
wrote on 18 sep 2006 in microsoft.public.inetserver.asp.general:
Follow-up on previous post.

I have narrowed it down to the fact that I call the vbscript code from
jscript code, and anything with a decimal in the number fails.

Changing the default page language to vbscript and calling
formatpercent directly works fine for any number.

What is most peculiar (not to mention *extremely* frustrating) is that
this same code on another site on the same server works fine. I've
deleted/recreated the web app in IIS as well.
Could be a IIS version problem?
<%@language=jscript%>

<script language=vbscript runat=server>
function frmtPercent (nNumber)
fmrtPercent = formatpercent(nNumber,2)
end function
</script>

<%
frmtPercent(0) --0.00%
Like this, it returns nothing.
frmtPercent(1) --100.00%
fmrtPercent(0.5) --overflow 800a0006
%>

Please help....
The below, which should be copied to an empty test.asp,
works fine here,
please test:

<%@language=jscript%>

<%
var x = 0;
response.write(x+'<br>');
response.write(fmrtPercent(x)+'<br>');
x = 7;
response.write(x+'<br>');
response.write(fmrtPercent(x)+'<br>');
x = 0.7;
response.write(x+'<br>');
response.write(fmrtPercent(x)+'<br>');

response.write(0.5+'<br>');
response.write(fmrtPercent(0.5)+'<br>');
%>

<script language=vbscript runat=server>
function fmrtPercent(nNumber)
fmrtPercent = formatpercent(nNumber,2)
end function
</script>

and returns:

0
0.00%
7
700.00%
0.7
70.00%
0.5
50.00%
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 18 '06 #3
dk******@kccomputersales.com wrote:
<script language=vbscript runat=server>
function frmtPercent (nNumber)
fmrtPercent = formatpercent(nNumber,2)
end function
</script>

<%
frmtPercent(0) --0.00%
frmtPercent(1) --100.00%
fmrtPercent(0.5) --overflow 800a0006
%>
Does it help if you change your function like this? VBScript functions like
this may not be able to handle all numeric data types.

Function frmtPercent (nNumber)
frmtPercent = formatpercent(CSng(nNumber),2)
End Function
Also, it helps to spell your function correctly in your interior assignment
(frmtPercent is not the same as fmrtPercent).
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Sep 18 '06 #4
Typos were introduced in composing the posting...sorry.

I copied the website to a different server box running same os, same
IIS, same patch levels. It works fine. Also, as I mentioned, the same
code on the same box as the failing code is also working.

In addition, the code works for any integer source value (0, 1, -1, 5,
etc.). It is only when I call the formatpercent function with a
decimal number.

I went further and hardcoded values in the vbscript function, so the
value passed from jscript is ignored completely -- same results.

See code below, if the value in the vbscript function is changed to
1.01, it fails. So I know that it is not the value passed by jscript.

<%@language=jscript%>

<script language=vbscript runat=server>
function frmtPercent (nPercent)
frmtPercent = formatpercent(1.00)
end function
</script>

<%
x = 0.050
Response.write (frmtPercent(x));
%>

For some reason, vbscript formatpercent just does not like decimal
numbers just on this one site on this server.

--David

Dave Anderson wrote:
dk*@kccomputersales.com wrote:
<script language=vbscript runat=server>
function frmtPercent (nNumber)
fmrtPercent = formatpercent(nNumber,2)
end function
</script>

<%
frmtPercent(0) --0.00%
frmtPercent(1) --100.00%
fmrtPercent(0.5) --overflow 800a0006
%>

Does it help if you change your function like this? VBScript functions like
this may not be able to handle all numeric data types.

Function frmtPercent (nNumber)
frmtPercent = formatpercent(CSng(nNumber),2)
End Function
Also, it helps to spell your function correctly in your interior assignment
(frmtPercent is not the same as fmrtPercent).
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Sep 18 '06 #5
wrote on 18 sep 2006 in microsoft.public.inetserver.asp.general:
<%
x = 0.050
Response.write (frmtPercent(x));
%>

For some reason, vbscript formatpercent just does not like decimal
numbers just on this one site on this server.
What about regional settings?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 18 '06 #6
dk******@kccomputersales.com wrote:
For some reason, vbscript formatpercent just does not like
decimal numbers just on this one site on this server.
Even when you use my suggestion?

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Sep 18 '06 #7
First -- Thanks for all the suggestions, guys, I appreciate your time
and assistance!

I didn't try your suggestion because it didn't seem to be related to
the variable being sent from the jscript.

I just now tried changing the vbscript function frmtPercent to call
formatpercent(CSng(nNumber)) as suggested and still get the overflow
error.

What in regards to regional settings should I look at? Is that per
site? I have not specifically set anything. As mentioned, I have
deleted and created a new Web Site in IIS. It is just this one site on
this one box. I will try putting it in a different App Pool in IIS.

In fact, this code (below) works as is on a different site on that box,
but not on this site. I literally copied from the non-working site to
another and it works.

<%@language=jscript%>
<script language=vbscript runat=server>

function formatPerc (nPercent)
formatPerc = formatpercent (nPercent,2)
end function
</script>

<%
var n = Number(1.1)
Response.write (n + ' before')
Response.write (formatPerc(n),' after')
%>

Dave Anderson wrote:
dk******@kccomputersales.com wrote:
For some reason, vbscript formatpercent just does not like
decimal numbers just on this one site on this server.

Even when you use my suggestion?

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Sep 18 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

29 posts views Thread by Christopher Brandsdal | last post: by
27 posts views Thread by REH | last post: by
7 posts views Thread by wij | last post: by
25 posts views Thread by junky_fellow | last post: by
8 posts views Thread by starffly | last post: by
42 posts views Thread by thomas.mertes | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.