473,770 Members | 6,978 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 5798
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
6026
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
4566
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
2423
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
6263
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
10673
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
2755
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
8260
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
6611
by: .nLL | last post by:
Erorr is --------------------- Microsoft VBScript runtime error '800a0046' Permission denied /a.asp, line 3 -----------------------
42
7035
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
10228
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10057
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...
0
9869
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8883
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
7415
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
5312
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
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
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
2
3575
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.