473,385 Members | 1,782 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 5768
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: Christopher Brandsdal | last post by:
If I have a .ASP page that runs JScript code - is it possible to include an ..ASP page that runs VBscript???
27
by: REH | last post by:
I asked this on c.l.c++, but they suggested you folks may be better able to answer. Basically, I am trying to write code to detect overflows in signed integer math. I am trying to make it as...
7
by: wij | last post by:
Hi: Is there better way of detecting multiplication overflow for type long than by using double precision of lldiv to verify the result? Thanks in advance. I.J.Wang
25
by: junky_fellow | last post by:
Is there any way by which the overflow during addition of two integers may be detected ? eg. suppose we have three unsigned integers, a ,b, c. we are doing a check like if ((a +b) > c) do...
8
by: starffly | last post by:
In my program, the caculated value is supposed to be no more than the constant named MAXINT,otherwise, overflow error will be informed.however, I cannot test if the value exceeds MAXINT within the...
2
by: lexor | last post by:
Hi! I'm struggling with a strange IE behavior regarding tables. I have a table like the following one <table cellpadding="0" cellspacing="0" border="1" width="500"> <tr> <td><div...
3
by: grace01 | last post by:
My asp webpage was working well in the past 5 years. Recently it shows the message: Microsoft VBScript runtime error '800a0006' Overflow: 'addOrder' The source code is as follow: 'insert...
0
by: .nLL | last post by:
Erorr is --------------------- Microsoft VBScript runtime error '800a0046' Permission denied /a.asp, line 3 -----------------------
42
by: thomas.mertes | last post by:
Is it possible to use some C or compiler extension to catch integer overflow? The situation is as follows: I use C as target language for compiled Seed7 programs. For integer computions the C...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.