Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 12th, 2003, 04:53 PM
Authorized User
 
Join Date: Jun 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default detail-master pages

I would like to create a hyperlink on data retrieved from a database that would sent the user to detailed information from a database..
ex: a persons name(hyperlink) when clicked on by a user, gives detailed information of that person
does one of the wrox books cover this? Does anyone know a good tutorial i could follow? or book? I recently finished "beginning asp databases"
thank you..
 
Old June 13th, 2003, 04:16 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

I'm surprised beginning asp databases doesn't cover stuff like this. The way you choose to do it will depend on what your data structure is, but the basic principle is that you provide a hyperlink which contains the data needed to identify the record which contains the detailed information.

For example, say you want to produce a list of books, with a link to detail for each of the authors. Lets say you also have a simple table structure like this (the ExtraInfo field would be the detail you want to show - in reality it could be many fields):
Books - containing ISBN, Title, AuthorID
Authors - containing AuthorID, AuthorName, ExtraInfo

So we want to produce a table containing
ISBN, Title, AuthorName
for each book, and make the AuthorName a link to the ExtraInfo data.

then lets say you select all the books with this SQL
Code:
SELECT b.ISBN, b.Title, b.AuthorID, a.AuthorName
FROM Books b INNER JOIN Authors a
ON b.AuthorID = a.AuthorID
and loop through the resultset (called rs) writing out an html table, you would have something like this:
Code:
... code to connect to db and run the query goes here
Response.Write "<table><tr><td>ISBN</td><td>Title</td><td>Author</td></tr>"
Do While Not rs.EOF
  Response.Write "<tr>"
  Response.Write "<td>" & rs("ISBN") & "</td>"
  Response.Write "<td>" & rs("Title") & "</td>"
  Response.Write "<td>"
  Response.Write "<a href='detailpage.asp?authorid=" & rs("AuthorID") & "'</a>"
  Response.Write rs("AuthorName") & "</td>"
  Response.Write "</tr>"
  rs.MoveNext
Loop
Response.Write "</table>"
So that's your html table created.

Then you write detailpage.asp which picks up the authorid from the QueryString and uses it to query the Authors table and return and display the ExtraInfo field.

There are other ways to pass AuthorID to the next page (e.g use js to populate a hidden field in a form and then submit the form), but this gives you the general principle.

hth
Phil





Similar Threads
Thread Thread Starter Forum Replies Last Post
master-detail hhpatek ADO.NET 0 April 3rd, 2008 02:53 PM
Master Detail prasanta2expert Access VBA 1 October 1st, 2007 06:37 AM
master/detail page yteferi ASP.NET 2.0 Basics 6 April 12th, 2006 09:04 AM
master/detail pages with Repeaters ben21 Classic ASP Basics 0 September 19th, 2005 06:18 AM
master/detail beeyule Dreamweaver (all versions) 1 January 18th, 2005 02:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.