When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles [1.x] [2.0]
ASPFAQs.com
Message Board
Related Web Technologies
User Tips!
Coding Tips
Search

Sections:
Book Reviews
Sample Chapters
Commonly Asked Message Board Questions
Headlines from ASPWire.com
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
Web Hosts
XML Info
Information:
Advertise
Feedback
Author an Article
Technology Jobs



















internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers
ASP ASP.NET ASP FAQs Message Board Feedback ASP Jobs
Print this page.

.Net Developer
Professional Technical Resources
US-WA-Bellingham

Justtechjobs.com Post A Job | Post A Resume

Published: Tuesday, February 08, 2000

Displaying Parent/Child Database Relationships through an ASP Page
By Syed Armoghan Qadir Shah


As the Internet grows the need for dynamic data grows. I looked at several techniques on how display data using ASP and HTML. None of the techniques satisfied my needs. I wanted to look at my data over the Internet in Master/Detail fashion. In Relational data bases you can relate to pieces of your data. Like the Parent/Child relationship where, say there is a Customer table and an Orders table, you want to find orders relating to a particular customer. To setup such a relationship, the primary key in Customer table would be a foreign key in the Orders table. This key will pull down information from the data base.

- continued -

A Master/Detail relationship is the same concept. Let us talk about the Northwind Database. In that database there is an Orders table, If the user wants to see the related records in the Order Details table they would be displayed based on OrderID key which will establish a relationship between the two tables.

What I wanted to do was to be able to display a list of orders from the Orders table, having each record provide a hyperlink, that, if clicked, would display that particular order's entry from the Order Details table. I looked at an ASP-DB solution but that was too sophisticated for my needs.

Therefore, I decided to write my own program to help my users look at order details over the Intranet and internet. I got help from Microsoft in this project and the end result I want to share with you all. In the past I have definitely benefited from articles from 4Guys. This article is the first part of a three part series. In the second part I will show how to link two details with one Master Record. In the third and final part I will utilize ADO Data Shaping techniques to effectively query and Page through Recordsets. (To learn more about data shaping, be sure to read: Data Shaping and Advanced Data Shaping Techniques.)

In my code example in this article I will use the Northwind database which ships with Microsoft Office. Below you can see a quick ER diagram of the Northwind tables I will be using:

Orders
OrderIDAutonumber
CustomerIDNumber
OrderDateDate/Time
ShipNameText
... More irrelevant fields ...

Order Details
OrderIDNumber
ProductIDNumber
UnitPriceCurrency
QuantityNumber
DiscountNumber

Another thing I will be displaying in this article would be how to use multiple recordsets using ADO and how to effectively sort and search records.

The system contains two pages, Master.asp and Detail.asp. The code for these two pages are too lengthy to post in this article, but there are links to the source code and to an on-line demo at the bottom of this page. You can also demo the code presented in this article.

If you click on the OrderID field on the master page (Master.asp) it will show you that particular order's details (Detail.asp). I believe that my solution proves to be much simpler than using expensive solutions; furthermore, with my solution the has more control on what information to display. With a little modification to these scripts you can use this code for your own projects!

For feedback please email me at Armoshah@hotmail.com.


Attachments:

  • Download the source code for Master.asp in text format
  • Download the source code for Detail.asp in text format
  • Test out the application!


    About the Author:
    My name is Syed Armoghan Qadir Shah. I am consultant with Infoexperts. I am consulting for a company called Sei Incentives, Ltd. SEI is based in Irving Texas. In the past I have done work with EDS as a Data Warehouse programmer. I have done my MBA with MIS as a Major from University of Dallas in Irving TX. My skill set includes Visual Basic, ASP, HTML, SQL Server, Java and MS Access. I started doing web pages as a hobby and then developed immense interest in ASP using ADO and VB Script. This is one of my many solutions I developed for one of my clients. I benefited a lot from web sites like 4GuysFromRolla.com and ASPtoday.com and wanted to contribute something useful. I saw a lot of postings on the ASP Messageboard about dynamic data bases but solutions to these were either pretty intricate or expensive.

    Some of the sites I have worked on are www.infoexpertsusa.com, www.sei-incentives.com and www.ultratraders.com. It is my philosophy to make complex coding techniques fairly simple. I further believe that writing computer code is an art and not a science. I can be reached at Armoshah@hotmail.com. Happy Programming!


    Windows Internet Technology | ASP.NET [1.x] [2.0] | ASPMessageboard.com | ASPFAQs.com | Advertise | Feedback | Author an Article

  • internet.comearthweb.comDevx.commediabistro.comGraphics.com

    Search:

    Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

    Jupitermedia Corporate Info

    Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
    Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

    Whitepapers and eBooks

    Intel Whitepaper: Comparing Two- and Four-Socket Platforms for Server Virtualization
    IBM Solutions Brief: Go Green With IBM System xTM And Intel
    HP eBook: Simplifying SQL Server Management
    IBM Contest: Are You the Next Superstar? Join the "Search for the XML Superstar" Contest to Find Out
    Microsoft PDF: Top 10 Reasons to Move to Server Virtualization with Hyper-V
    Microsoft PDF: Six Reasons Why Microsoft's Hyper-V Will Overtake Vmware
    Microsoft Step-by-Step Guide: Hyper-V and Failover Clustering
    Intel PDF: Quad-Core Impacts More Than the Data Center
    Intel PDF: Virtualization Delivers Data Center Efficiency
    Go Parallel Article: PDC 2008 in Review
    Microsoft PDF: Top 11 Reasons to Upgrade to Windows Server 2008
    Avaya Article: Communication-Enabled Mashups: Empowering Both Business Owners and IT
    Intel Whitepaper: Building a Real-World Model to Assess Virtualization Platforms
      PDF: Intel Centrino Duo Processor Technology with Intel Core2 Duo Processor
    Microsoft Article: Build and Run Virtual Machines with Hyper-V Server 2008
    Go Parallel Article: Q&A with a TBB Junkie
    IBM Whitepaper: Innovative Collaboration to Advance Your Business
    Internet.com eBook: Real Life Rails
    IBM eBook: The Pros and Cons of Outsourcing
    Internet.com eBook: Best Practices for Developing a Web Site
    IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
    Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
    IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
    Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
    HP eBook: Guide to Storage Networking
    MORE WHITEPAPERS, EBOOKS, AND ARTICLES