473,598 Members | 3,209 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "abnormalit y" 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 5787
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=jsc ript%>

<script language=vbscri pt runat=server>
function frmtPercent (nNumber)
fmrtPercent = formatpercent(n Number,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 "abnormalit y" 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.publi c.inetserver.as p.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=jsc ript%>

<script language=vbscri pt runat=server>
function frmtPercent (nNumber)
fmrtPercent = formatpercent(n Number,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=jsc ript%>

<%
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=vbscri pt runat=server>
function fmrtPercent(nNu mber)
fmrtPercent = formatpercent(n Number,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******@kccomp utersales.com wrote:
<script language=vbscri pt runat=server>
function frmtPercent (nNumber)
fmrtPercent = formatpercent(n Number,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(C Sng(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=jsc ript%>

<script language=vbscri pt 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*@kccomputers ales.com wrote:
<script language=vbscri pt runat=server>
function frmtPercent (nNumber)
fmrtPercent = formatpercent(n Number,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(C Sng(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.publi c.inetserver.as p.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******@kccomp utersales.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(C Sng(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=jsc ript%>
<script language=vbscri pt 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******@kccomp utersales.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
6006
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
4533
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 efficient as possible without resorting to assembly language, and without causing undefined behavior. That, of course, means catching the overflow before it happens. What I asked was (stripping any relevance to C++):
7
2409
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
6232
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 something;
8
10658
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 integer scope smaller than MAXINT,so I want to seek a measure to test the excess without the value's comparing to MAXINT. Please let me know if you have a good idea. THX.
2
2743
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 style="overflow:hidden;width: 355px;">Header1</div></td> <td><div style="overflow:hidden;width: 100px;">Header2</div></td> <td><div style="width: 100%;overflow:hidden;">Header3</div></td> </tr>
3
8248
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 data into database dim objCart
0
6600
by: .nLL | last post by:
Erorr is --------------------- Microsoft VBScript runtime error '800a0046' Permission denied /a.asp, line 3 -----------------------
42
6989
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 type 'long' is used. That way native C speed can be reached. Now I want to experiment with raising a Seed7 exception (which is emulated with setjmp(), longjmp() in C) for integer
0
7992
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8400
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8051
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6725
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5850
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5438
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3898
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3940
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2414
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.