Home | Advertising Info6 USERS CURRENTLY ONLINE   
PowerASP
   Site Search Contact Us Sunday, May 12, 2024  

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
Classic ASP - Code Samples
 PowerASP Code Help Area : Classic ASP - Code Samples
Subject Topic: Searching From Listboxes Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Bullschmidt
Newbie
Newbie
Avatar

Joined: July/06/2004
Location: United States
Online Status: Offline
Posts: 12
Posted: July/06/2004 at 1:17am | IP Logged Quote Bullschmidt

Example on a page receiving a post of a SQL statement based on two listboxes (MyCategory and MyLocation) that might each have a value of "" (i.e. blank) to show all with no criteria restrictions.

' Dim var.
Dim MyCategory
Dim MyLocation

' Get posted form vars.
MyCategory = Request.Form("MyCategory")
MyLocation = Request.Form("MyLocation")

' Set strSQL.
strSQL = "SELECT * MyTable WHERE (1=1)"
If MyCategory <> "" Then
 strSQL = strSQL & " AND (MyCategory='" & MyCategory & "')"
End If
If MyLocation <> "" Then
 strSQL = strSQL & " AND (MyLocation='" & MyLocation  & "')"
End If

 



__________________
J. Paul Schmidt, Freelance ASP Web Developer
www.Bullschmidt.com
Classic ASP Design Tips, ASP Web Database Sample (Freely Downloadable)
Back to Top View Bullschmidt's Profile Search for other posts by Bullschmidt Visit Bullschmidt's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright © 1998 - 2024 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

Active Server Pages ASP control controls class classes module script Scripts applet CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspprotect.com, www.cjwsoft.com,www.aspclassifieds.com,www.aspphotogallery.com