Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 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 August 26th, 2004, 08:58 AM
Registered User
 
Join Date: Aug 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Setting a variable using Select Case

Hi all!
Sorry if this is a dumb question but I am very new to ASP. I am trying to use a select case to set a variable but it doesn't seem to work:

Select case strSearchCat
    case "option1"
    strSearchVia = "Member ID='"
    case "option2"
    strSearchVia = "Forename='"
End Select

Is it not possible to to set a variable in this way?? In the book (beginning Active Server Pages 3.0) all examples are given using the response.write command, e.g.

Select case strSearchCat
    case "option1"
    Response.Write "you have chosen option 1"
    Case "Option2"
    Response.Write "you have chosen option 2"
End Select

Any help very, very much appreciated!!
THANKYOU!
ADAM
 
Old August 26th, 2004, 11:09 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Yes that will work, but I'm thinking your problem may not be that specifically. What exactly is your problem, and could you then post more code for that?

Brian
 
Old September 4th, 2004, 02:09 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Response.Write "you have chosen option 1" is to output on your page.

strSearchVia = "Member ID='" whereas here you are assiging value to a variable. So both are right, only difference is that RESPONSE.WRITE writes the output to your page on browser, other stores it in a variable.

Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
select case bacster Classic ASP Basics 2 May 1st, 2006 06:31 PM
Using IS in Select Case mega Pro VB 6 4 August 22nd, 2005 08:40 AM
Select Case junaidraja30 Access VBA 1 February 5th, 2005 08:30 PM
Select Case morpheus VB How-To 1 August 13th, 2003 09:14 AM
Select Case ziwez0 .NET Web Services 8 July 11th, 2003 02:55 PM





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