Hello,
I am having a problem getting some code to calculate/work in an ASP page. In
the snippet below I am collecting some data (inthours1 and intrate1) and
then want to calculate a value (intsub1) to display on the page. If I set
intsub1 to a fixed value, the page displays correctly. If I try the
calculation listed below, I get a 500 internal server error on the page.
What am I doing wrong???
Thanks,
Joe
<%
Dim strSDate1, strEng1, intHours1, intRate1, intSub1
intHours1 = Trim(Request.Form("shours1"))
intRate1 = Trim(Request.Form("srate1"))
' Sub total buckets
intSub1 = inthours1 * intrate1
%>
<td><INPUT TYPE=TEXT NAME="SHours1" VALUE="" SIZE=10 MAXLENGTH=10></td>
<td><INPUT TYPE=TEXT NAME="SRate1" VALUE="" SIZE=12 MAXLENGTH=12></td>
<td><%= intSub1 %> </td> 5 1423
JStrauss wrote: Hello, I am having a problem getting some code to calculate/work in an ASP page. In the snippet below I am collecting some data (inthours1 and intrate1) and then want to calculate a value (intsub1) to display on the page. If I set intsub1 to a fixed value, the page displays correctly. If I try the calculation listed below, I get a 500 internal server error on the page. What am I doing wrong???
Hard to say without knowing what the real error is. Follow the steps shown
in this article to enable the real error to be displayed: http://www.aspfaq.com/show.asp?id=2109
Thanks, Joe
<% Dim strSDate1, strEng1, intHours1, intRate1, intSub1
intHours1 = Trim(Request.Form("shours1")) intRate1 = Trim(Request.Form("srate1"))
We (you) can't troubleshoot this calculation without knowing what values are
going into it. Use Response.Write to facilitate debugging:
Response.Write "intHours1 contains """ & intHours1 & """<BR>"
Response.Write "intRate1 contains """ & intRate1 & """<BR>"
Response.End
If this doesn't tell you what the problem is, show us the result.
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
You need to know what an error is before you can debug it. http://www.aspfaq.com/show.asp?id=2109
Ray at home
"JStrauss" <su**@strausselec.com> wrote in message
news:eZ*************@TK2MSFTNGP11.phx.gbl... Hello, I am having a problem getting some code to calculate/work in an ASP page.
In the snippet below I am collecting some data (inthours1 and intrate1) and then want to calculate a value (intsub1) to display on the page. If I set intsub1 to a fixed value, the page displays correctly. If I try the calculation listed below, I get a 500 internal server error on the page. What am I doing wrong???
Thanks, Joe
<% Dim strSDate1, strEng1, intHours1, intRate1, intSub1
intHours1 = Trim(Request.Form("shours1")) intRate1 = Trim(Request.Form("srate1"))
' Sub total buckets intSub1 = inthours1 * intrate1 %> <td><INPUT TYPE=TEXT NAME="SHours1" VALUE="" SIZE=10 MAXLENGTH=10></td> <td><INPUT TYPE=TEXT NAME="SRate1" VALUE="" SIZE=12 MAXLENGTH=12></td> <td><%= intSub1 %> </td>
Thanks for the tips. I am getting a type mismatch error, which I should be
able to track down. Thanks for the help.
Joe
"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:O6**************@TK2MSFTNGP10.phx.gbl... You need to know what an error is before you can debug it.
http://www.aspfaq.com/show.asp?id=2109
Ray at home
"JStrauss" <su**@strausselec.com> wrote in message news:eZ*************@TK2MSFTNGP11.phx.gbl... Hello, I am having a problem getting some code to calculate/work in an ASP
page. In the snippet below I am collecting some data (inthours1 and intrate1) and then want to calculate a value (intsub1) to display on the page. If I
set intsub1 to a fixed value, the page displays correctly. If I try the calculation listed below, I get a 500 internal server error on the
page. What am I doing wrong???
Thanks, Joe
<% Dim strSDate1, strEng1, intHours1, intRate1, intSub1
intHours1 = Trim(Request.Form("shours1")) intRate1 = Trim(Request.Form("srate1"))
' Sub total buckets intSub1 = inthours1 * intrate1 %> <td><INPUT TYPE=TEXT NAME="SHours1" VALUE="" SIZE=10 MAXLENGTH=10></td> <td><INPUT TYPE=TEXT NAME="SRate1" VALUE="" SIZE=12 MAXLENGTH=12></td> <td><%= intSub1 %> </td>
"JStrauss" <su**@strausselec.com> wrote in message news:<eZ*************@TK2MSFTNGP11.phx.gbl>... Hello, I am having a problem getting some code to calculate/work in an ASP page. In the snippet below I am collecting some data (inthours1 and intrate1) and then want to calculate a value (intsub1) to display on the page. If I set intsub1 to a fixed value, the page displays correctly. If I try the calculation listed below, I get a 500 internal server error on the page. What am I doing wrong???
Thanks, Joe
<% Dim strSDate1, strEng1, intHours1, intRate1, intSub1
intHours1 = Trim(Request.Form("shours1")) intRate1 = Trim(Request.Form("srate1"))
' Sub total buckets intSub1 = inthours1 * intrate1 %> <td><INPUT TYPE=TEXT NAME="SHours1" VALUE="" SIZE=10 MAXLENGTH=10></td> <td><INPUT TYPE=TEXT NAME="SRate1" VALUE="" SIZE=12 MAXLENGTH=12></td> <td><%= intSub1 %> </td>
You have to convert the request.form to an int or float before you can
multiply it, don't you?
i.e.
intHours1=cint(trim(request.form("shours1"))
You should do some type checking before this.
> intHours1=cint(trim(request.form("shours1"))
Take this a step further and append a zero to the beginning. CInt will
throw an error if there is nothing in request.form("shours1"). So do
this:
intHours1 = cint("0" & trim(request.form("shours1")) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: DebbieG |
last post by:
I have no idea how to start with this one.
I have a subform where records could look similar to:
Infraction Date Points
01/01/2000 3
06/01/2002 1
Somehow, I've got to...
|
by: gsb58 |
last post by:
Hi!
Recently we, in Norway changed to three different VAT levels. All three
needs to be on the invoice program. This is easy obtained via a new
field and set the rowsource to valuelist and make...
|
by: roygon |
last post by:
Hello,
I have a C# application that runs a relatively complex simulation
which, on a typical computer, could take up to 10 seconds. I am now
trying to port this application over to ASP.NET so...
|
by: heckstein |
last post by:
I am a novice working in Access 2002 trying to run a query I created. I am receiving the error "scaling of decimal value resulted in data trunction", which I have determined is due to this...
|
by: igotyourdotnet |
last post by:
I have a dataset that is populating my gridview, but I have a data in the
dataset coming out like .011 and showing in the gridView as .011%. I need to
calculate that so it shows as 1.1% and not...
|
by: sara |
last post by:
i am studying a computer engineering and i started taking programming
using C++ since month
i have question i think it`s easy for you all *prof.programmer* but
it`s bit diffecult for me plzz i...
|
by: 60325 |
last post by:
This is the page where I collect the data in drop-down boxes with
values of 1-10 and send it to a submitted page to do calculations.
Example:
Employee1 TeamScore(1-10)
Employee2 ...
|
by: The alMIGHTY N |
last post by:
Hi all,
Let's say I have a simple math formula:
sum (x * y / 1000) / (sum z / 1000)
I have to do this across 50 items, each with an x, y and z value, when
the page first loads AND when a...
|
by: Barry L. Bond |
last post by:
Greetings!
I just got a new Peet Brothers Ultimeter 2100 Weather Station. This
new one has a way to display the heat index, if you press the "dew point"
key twice.
Being aware of all the...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
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...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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,...
|
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...
| |