Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Using <= in Select Case statements
Old 03-30-2007, 05:39 PM Using <= in Select Case statements
Super Talker

Posts: 116
Trades: 0
I'm trying to program something in ASP to isolate a date using a "Select Case" in ASP/VBScript

What I'm trying to do is pull a record from a database (lnID) based on the date.

Right now this is the code I'm using

Dim lnDay, lnNotifyDay
lnDay = day(now)


If lnDay <= 20 Then
lnID = lnDay + 2
lnNotifyDay = lnDay + 2
Else
lnID = (lnDay - 22) + 2
lnNotifyDay = lnDay + 2
End If

I really want to use a "Select Case" but if I try this....

Select Case lnDay
Case < 20
lnID = lnDay
lnNotifyDay = lnDay + 2
End Select

I get an error on the "< 20"

It seems as if the Select Case hates numbers. Is this true? Obviously I'm going to add more Case statements but this is driving me nuts!
DonnaZ is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-30-2007, 08:21 PM Re: Using <= in Select Case statements
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
I think you'd want to use syntax like Case Is < 20, or a between operator.

Here's what Microsoft has to say on the matter: http://msdn2.microsoft.com/en-us/library/cy37t14y.aspx
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 03-31-2007, 04:25 AM Re: Using <= in Select Case statements
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
the Case statement in VBScript is limited to equalities in its use

There is no "less than" or "greater than" only "equal to"

You can check for equality to multiple values by using a comma delimited list

Case 20,21,22,23, ...

then use Case else to catch anything outside that list
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-31-2007, 06:41 PM Re: Using <= in Select Case statements
Super Talker

Posts: 116
Trades: 0
Thanks to both of you. I'll try this tonight.

DonnaZ
DonnaZ is offline
Reply With Quote
View Public Profile
 
Old 03-31-2007, 06:59 PM Re: Using <= in Select Case statements
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
If you want to use <=, use If. I personally prefer it to Case because it's much more flexible and because I think the Select Case syntax looks weird.

Something like if number <= 20 then ... elseif number <= 30 then ... else ... end if.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Reply     « Reply to Using <= in Select Case statements
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.77637 seconds with 12 queries