Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 1st, 2008, 03:30 PM
Authorized User
 
Join Date: Dec 2005
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default Greater than, less than

I need to compare a variable to a grid of numbers using ASP. If the variable is less than 10, it will set "fee" to 10. If the variable is equal to 10 but less than 100, it will set "fee" to 50. If the variable is greater or equal to 100, it will set "fee" to 100.

What's the best way to write this in ASP?

I've tried
<% Dim fee
   If x < 10 then fee = 10
   If x =>10 and <100 then fee = 50
   If x = >=100 then fee = 100
end If %>

I keep getting syntax errors or at the "end if" statement I get an "expected statement" error.

Any help is really appreciated!!!!!
 
Old February 1st, 2008, 05:13 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

This line
If x = >=100 then fee = 100

Should be
If x >=100 then fee = 100

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
 
Old February 1st, 2008, 05:47 PM
Authorized User
 
Join Date: Dec 2005
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry, that extra = was a typo on here...that's what I get for not copying and pasting! Does anyone see why this code wouldn't work otherwise?

Thanks.
 
Old February 1st, 2008, 06:38 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

If statements that span one line do not require an End If.

What you should be doing is something like this:
   If x < 10 then
      fee = 10
   ElseIf x => 10 and x < 100 then
      fee = 50
   Else
      fee = 100
   End If

hth


================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Uplad txt field of size greater than 12 mb rapraj PHP Databases 3 October 28th, 2007 09:36 AM
Warning: fread(): Length parameter must be greater surendran PHP How-To 1 September 20th, 2006 05:41 AM
Upload Files of Greater Size (>5Mb) saravananedu ASP.NET 1.0 and 1.1 Basics 1 May 4th, 2005 12:07 AM
Select Where Greater Than Count [email protected] SQL Language 3 April 29th, 2004 05:14 AM
Greater than KennethMungwira VS.NET 2002/2003 0 November 4th, 2003 06:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.