navigation
Thomas Brunt's OutFront Hosting
 
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Microsoft MVP
 

Spooky's Databases > Querying the Database with a Search Form

One of the useful features of adding database access to your web site, is that your viewers can now customize a search form to locate the information they want.

Adding a Database Search form
 

  1. On a new or existing page, you will insert a Database Results Wizard (DRW).
     
  2. Open the Insert menu, select  Database, and click Results
     
  3. Select the Use an existing database connection button. Click on the database name you wish to use. Each persons database name will be different.



    Click Next.

     
  4. Make sure the Record source option is selected and the table
    you wish to query is selected from the list. Click Next.



     
  5. Select More Options.


     
  6. In the More Options box, click Criteria.



     
  7. In the Criteria dialog box, click Add.



     
  8. In the Add Criteria dialog box, click to select the Field Name you wish to query from the list.



     
  9. In the Comparison box, select the type of query comparison.
    eg. If the field in your database is a text field, and you want to provide 'LIKE' queries, (where the field starts with, ends with, or contains the phrase) 
    Select the 'Contains' option from the Comparison list.
    Normally you would use Equals (for numeric fields) or Contains (for text fields) in the Comparison list.
    If you are going to use more than 1 query box on your form, you may wish to select 'OR' rather than the 'AND' option
    eg. 
    AND :
    Selection = Box1 AND Selection = Box2
    OR : Selection = Box1 OR Selection = Box2
    Click OK.
    Note : 'Use this search form field' allows you to specify the name of the form you are passing to the search page.
     
  10. To add more criteria (search boxes) repeat this process from 'G'
     
  11. In the Criteria dialog box, click OK.
     
  12. When the page is first displayed on the web,  you can set a default search by choosing a value to be used. 
    Notice, that now you have set a criteria, the 'Defaults' option is enabled.
    Select 'Defaults'


     
  13. Select Edit to add a default value to the input parameters
    Entering NULL will start an initial search with no results.



    Enter OK
     
  14. In Step 3 of the DRW, click Next.
     
  15. Click Next in Step 4 of the DRW, and click Finish in Step 5 
     
  16. On the File menu, click Save As
    Make sure the page is saved as "file.asp"  and not "file.htm"

Microsoft Corporation in no way endorses or is affiliated with "OutFront." 
OutFront is published and edited by Thomas Brunt
440 Great Circle Dr., St. Matthews, SC 29135.  803-655-6151
© 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 All Rights Reserved
Click here to view our privacy statement.