Closed Thread Icon

Topic awaiting preservation: ASP calculation problem (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12969" title="Pages that link to Topic awaiting preservation: ASP calculation problem (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: ASP calculation problem <span class="small">(Page 1 of 1)</span>\

 
Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 11-05-2003 00:40

Hi, guys. Please help.
I am trying to calculate using ASP.

Here is my code:

code:
If Request.Form("cal") = "Calculation" Then
Dim q,p
q = Request.Form("quant")
p = Request.Form("price")
Response.write(q)
Response.Write(p)
Response.write(q*p)
End IF



When user click calculation button, cost have to be printed on the screen.
But this line:

Response.Write(q*p)

it is causing error.
I don't know why cuz I did tutorial and got a code like this:

code:
<%
sub vbproc(num1,num2)
response.write(num1*num2)
end sub
%>



Hmm......Please help!

Hiroki Kozai

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 11-05-2003 00:57

Hiroki: Can ASP transType automagically the variables ? I ask that because I'm pretty sure the the values returned by Request.Form( ... ) are some Strings. Try to convert/cast the variables in float or double.

What kind of error message do ASP return ?

Mathieu "POÏ" HENRI

Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 11-05-2003 01:57

Thanks for your reply.
Yeah, error message was saying about sting or something like that.
I guess I have to do like you said.
Casting string to number!
Thanks.

Hiroki Kozai

Hiroki
Paranoid (IV) Inmate

From: NZ
Insane since: Dec 2002

posted posted 11-05-2003 02:38

Hmm.....I am stying to convert String to Interger. But some reason, doesn't work. I did like below.
Always said: CInt type mismatch.......
Do you know why?

code:
q = Trim(Request.Form("quant"))
p = Trim(Request.Form("price"))
pp = 0
qq = 0
pp = CInt(p)
qq = CInt(q)



Is it possible to convert form text field value to interger???
Hmm....


Hiroki Kozai

[This message has been edited by Hiroki (edited 11-05-2003).]

« BackwardsOnwards »

Show Forum Drop Down Menu