Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 28th, 2005, 11:23 AM
Authorized User
Points: 292, Level: 5
Points: 292, Level: 5 Points: 292, Level: 5 Points: 292, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: , , .
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default Math functions-Please help!



I have a variable coming through an XML string into my .asp page (payamt). I need to send this through to be processed, but...I also need to create a NEW field called "totalamount". The totalamount should be equal to the payamt * 3%. I've tried making sure that the fields are set as Integers, but I keep getting a "Type Mismatch" error. I have a looming deadline...please help!

        Set objpayamt = xmlDoc.getElementsByTagName("payamt")
    varpayamt = objpayamt.item(0).text
    Dim convfee
    Dim payamt
    Dim totalamount
    Set payamt = CInt("varpayamount")
    Set totalamount = ("payamt" * .03)
Reply With Quote
  #2 (permalink)  
Old December 28th, 2005, 11:34 AM
Imar's Avatar
Wrox Author
Points: 72,035, Level: 100
Points: 72,035, Level: 100 Points: 72,035, Level: 100 Points: 72,035, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,079
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Is this related to ASP.NET 2.0??? If not, you're better off posting these kind of questions in one of the Classic ASP forums, accessible by clicking View All Forums on the left.

That said, take a look at this:

Set totalamount = ("payamt" * .03)

You try to multiple the *string* "payamt" by .03. Drop the quotes and it should work.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #3 (permalink)  
Old December 28th, 2005, 11:42 AM
Authorized User
Points: 292, Level: 5
Points: 292, Level: 5 Points: 292, Level: 5 Points: 292, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: , , .
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar,

Thanks for the quick reply. I dropped the " ", but this is the error I'm still getting.
  Also, sorry if I mis-posted, wasn't sure exactly which forum to use.

    Microsoft VBScript runtime error '800a000d'

    Type mismatch: 'CInt'


Reply With Quote
  #4 (permalink)  
Old December 28th, 2005, 11:46 AM
Imar's Avatar
Wrox Author
Points: 72,035, Level: 100
Points: 72,035, Level: 100 Points: 72,035, Level: 100 Points: 72,035, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,079
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Then try this:

Response.Write(objpayamt.item(0).text)
Response.End

What does it write to the screen?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #5 (permalink)  
Old December 28th, 2005, 12:06 PM
Authorized User
Points: 292, Level: 5
Points: 292, Level: 5 Points: 292, Level: 5 Points: 292, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: , , .
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Am getting this now:

Microsoft VBScript runtime error '800a01a8'

Object required: 'varpayamt'

/new/upshurCodej2.ASP, line 132

Here's the re-written code:
    Set objpayamt = xmlDoc.getElementsByTagName("payamount")
    varpayamt = objpayamt.item(0).text
Response.Write(varpayamt.item(0).text)
Response.End


Reply With Quote
  #6 (permalink)  
Old December 28th, 2005, 12:21 PM
Imar's Avatar
Wrox Author
Points: 72,035, Level: 100
Points: 72,035, Level: 100 Points: 72,035, Level: 100 Points: 72,035, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,079
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
quote:Originally posted by Imar
 Then try this:

Response.Write(objpayamt.item(0).text)
Response.End
You used varpayamt.item(0).text instead of objpayamt.item(0).text

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Math Functions on dynamic data jroxit Classic ASP Basics 3 January 23rd, 2007 12:07 PM
Getting percentages with math functions tslag XSLT 1 June 22nd, 2006 11:47 AM
Math Namespace transtar C# 3 February 12th, 2006 09:50 AM
Graphics Math Functions vb certified Pro VB.NET 2002/2003 2 January 1st, 2006 11:06 AM
Why are my math functions not being included? jkeen BOOK Beginning Linux Programming, 3rd Edition 4 October 22nd, 2004 05:29 AM



All times are GMT -4. The time now is 10:50 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.