HOW TO: Query Two Tables in the Same Database in FrontPage 2000 (310509)



The information in this article applies to:

  • Microsoft FrontPage 2000

This article was previously published under Q310509
For a Microsoft FrontPage 2002 version of this article, see 318281.

IN THIS TASK

SUMMARY

This step-by-step article describes how to retrieve information from two tables in a database. The example case uses SQL statements to find data in both tables that matches a submitted value for a column that is used in both tables.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site: For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: back to the top

Create Query with Two Tables

To set up using a search form to bring up specific values from two tables, follow these steps:
  1. Create two pages, with the titles Search.asp and Results.asp.
  2. Open the Search.asp page.
  3. On the Insert menu, point to Form, and then click One-Line Text Box.
  4. Right-click the text box, and then click Form Field Properties on the shortcut menu.
  5. In the Name box, type ID, and then click OK.
  6. Right-click the text box, and then click Form Properties on the shortcut menu.
  7. Click to select the Send to other check box, click Options, and then type results.asp in the Action box. Click OK twice.
  8. On the File menu, click Save.
  9. Click Results.asp.
  10. On the Insert menu, point to Database, and then click Results.
  11. Click to select the Use a sample database connection check box, and then click Next.
  12. Click to select the Custom query check box, and then click Edit.
  13. In the SQL Statement box, type or paste the following text:

    Select * From Categories,Products Where Categories.CategoryID=::ID:: and Categories.CategoryID=Products.CategoryID

    NOTE: This returns all the columns from the Categories and Products table where the ID sent from the Search.asp page matches the CategoryID in the Categories table and the Category ID in the Categories table matches the CategoryID in the Products table.
  14. Click OK.
  15. Click Next three times.
  16. Click to select the Display all records together check box, and then click to clear the Add search form check box.
  17. Click Finish.
  18. On the File menu, click Save.
  19. Open the Search.asp page.
  20. On the File menu, click Preview in Browser, and then click OK twice.
  21. In the text box, type 3, and then click Submit.
This returns all the columns from Categories and Products with a CategoryID of 3. If any valid ID is submitted, the correct records are returned.

back to the top


REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

206019 FP2000: ASP Web Wizard 2000 for Databases Available for Download

For more information about Active Server Pages (ASP), please see the following Microsoft Web site: back to the top







Modification Type:MajorLast Reviewed:10/26/2002
Keywords:kbhowto kbHOWTOmaster KB310509