If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > two options

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-25-05, 04:04
needasphelp needasphelp is offline
Registered User
 
Join Date: Feb 2005
Posts: 4
two options

i have got two sql statements that perform two seperate queries for the user. I want the user to select which one to perform either option a or option b. how can this be done. i think use of case function can be used but how do you you implement that.
Reply With Quote
  #2 (permalink)  
Old 02-27-05, 00:03
MrWizard MrWizard is offline
Registered User
 
Join Date: Mar 2003
Location: Atlanta, GA
Posts: 191
You can ask the user to select which one they want to do in a form with option buttons, and then retrieve the selected choice using the Request object on the action page of the form.

Then just test which they selected using an If statement, and execute the appropriate query.

Tim
__________________
Tim

Last edited by MrWizard; 02-27-05 at 00:09.
Reply With Quote
  #3 (permalink)  
Old 03-02-05, 19:32
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
Or if a textbox or listbox called WhichOne and the page gets posted:

Select Case lcase(Request.Form("WhichOne"))
Case "a"
[The code to run if the case is a]

Case "b"
[The code to run if the case is b]
End Select

Or

If lcase(Request.Form("WhichOne")) = "a" Then
[The code to run if the case is a]
Elseif lcase(Request.Form("WhichOne")) = "b" Then
[The code to run if the case is b]
End If
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On