SysChat

SysChat (http://www.syschat.com/forum.php)
-   Development (http://www.syschat.com/software-support/development/)
-   -   "Select Case" with VBScript (http://www.syschat.com/select-case-with-vbscript-2348.html)

mhookem 06-28-2007 08:50 AM

"Select Case" with VBScript
 
Hello, I've got a problem getting some VBScript to work. Can anyone point me in the right direction and tell me what I'm doing wrong?

Here is the code:


<body>
<%
Dim myNum
myNum=5
Select Case Number
Case 2
Response.Write("Two")
Case 3
Response.Write("Three")
Case 5
Response.Write("Five")
Else Case
Response.Write("No Number")
End Select
%>
</body>

I keep getting the error message 'An error occurred on the server when processing the URL. Please contact the system administrator'

Thanks

Martin

William_Wilson 06-28-2007 08:35 PM

vb script is not a language i am familiar with, but this has the setup of a switch statement of other languages, there is usually a break command at the end of each case to prevent incorrect output.

mhookem 06-29-2007 02:08 PM

VBScript
 
Quote:

Originally Posted by William_Wilson (Post 7288)
vb script is not a language i am familiar with, but this has the setup of a switch statement of other languages, there is usually a break command at the end of each case to prevent incorrect output.

Hello William, I've tried it but still no joy, I've even copy and pasted the code from several different sources.
Is there a possibility that it has something to do with my settings?

I've been practicing using IIS 7.0, and I've created cookies, Sessions and all sorts, but this just doesn't want to work!!

Regards

Martin

kjb_work 08-07-2008 05:13 PM

Quote:

Originally Posted by mhookem (Post 7283)
Hello, I've got a problem getting some VBScript to work. Can anyone point me in the right direction and tell me what I'm doing wrong?

Here is the code:


<body>
<%
Dim myNum
myNum=5
Select Case Number
Case 2
Response.Write("Two")
Case 3
Response.Write("Three")
Case 5
Response.Write("Five")
Else Case
Response.Write("No Number")
End Select
%>
</body>

I keep getting the error message 'An error occurred on the server when processing the URL. Please contact the system administrator'

Thanks

Martin

well first off I would say Number is not declared. If you wish to case on myNum then you should have


Select Case myNum
Case 2
do stuff
Case 3
do diff stuff
end select


VBscript does not have a break statement.

kjb

Wombat 08-07-2008 05:22 PM

I do not think the OP will bother with your reply, he/she was last seen in this thread on the 28th June 2007.

Leave old threads to wither and die...


All times are GMT -4. The time now is 07:49 AM.


Copyright © 2005-2013 SysChat.com


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54