Home | Advertising Info3 USERS CURRENTLY ONLINE   
PowerASP
   Site Search Contact Us Friday, March 29, 2024  

  Active InfoActive Info  Display List of Info MembersMemberlist  Search The InfoSearch  HelpHelp
  RegisterRegister  LoginLogin
Classic ASP - Code Samples
 PowerASP Code Help Area : Classic ASP - Code Samples
Subject Info: Searching From Listboxes A d d  -  P o s tAdd P o s t
Author
Message << Prev Info | Next Info >>
Bullschmidt
Newbie
Newbie
Avatar

Joined: July/06/2004
Location: United States
Online Status: Offline
Info: 12
Added: 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 info by Bullschmidt Visit Bullschmidt's Homepage
 

If you wish to make a comment to this info you must first login
If you are not already registered you must first register

  A d d  -  P o s tAdd P o s t
Printable version Printable version

Info Jump
You cannot add new info in this area
You cannot add to info in this area
You cannot delete your info in this area
You cannot edit your info in this area
You cannot create polls in this area
You cannot vote in polls in this area

   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 source code database MS SQL MS Access .mdb adovbs.inc cookies calendar codes sql commands scripts asp programming tutorials iis web server components CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspprotect.com, www.cjwsoft.com,www.aspclassifieds.com,www.aspphotogallery.com