DeveloperBarn Forums

Go Back   DeveloperBarn Forums > Programming & Scripting > Code Samples > Classic ASP

Discuss "Using Dropdown List Value in Database SQL Query" in the Classic ASP forum.

Classic ASP - Post your Classic ASP code samples here.


Reply « Previous Thread | Next Thread »  
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old April 2nd, 2008, 10:05 AM
richyrich's Avatar
Moderator


 
Join Date: Mar 2008
Location: Somewhere only we know...
Posts: 332
Thanks: 23
Thanked 26 Times in 26 Posts
Blog Entries: 1
Rep Power: 1
richyrich is on a distinguished road

Awards Showcase
Classic ASP JavaScript 
Total Awards: 2

Default Using Dropdown List Value in Database SQL Query

Using Dropdown List Value in Database SQL Query

This example is how to use a dropdown list value in a database query using ASP.

Form Page
Code:
<form id="form1" name="form1" method="post">
<select id="ddl" name="ddl" size="1">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
</form>
Query Page
Code:
Dim filter_value
'retrieve the value from the dropdown
filter_value = request.form("ddl")
 
'this is a very simplistic validation of the value received. More complicated versions should be used for complex dropdowns or textboxes.
if filter_value="yes" OR filter_value="no" then
 
      strsql = "SELECT field1,field2,field3 FROM tbl_name WHERE filter_field='" & filter_value & "'"
 
end if
Reply With Quote
Sponsored Links
Reply

  DeveloperBarn Forums > Programming & Scripting > Code Samples > Classic ASP

Bookmarks

Thread Tools
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
Forum Jump


Sponsored Links

ASP.NET Resource Index
a directory of ASP.NET tutorials, applications, scripts, assemblies and articles for the novice to professional developer.

Free Web Directory
Including Chats and Forums Resources, Offer automatic, instant and free directory submissions.
URLZ Web Directory
URLZ Web Directory

Free Web Directory - Add Your Link
The Little Web Directory
Free Web Directory
Pegasus free web directory is a free directory organised by categories.

Web Directory & SEO Services
dirroot web directory


All times are GMT -4. The time now is 08:35 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Copyright © 2008 DeveloperBarn.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