Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 12th, 2003, 04:53 PM
Authorized User
 
Join Date: Jun 2003
Location: , , .
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..
Reply With Quote
  #2 (permalink)  
Old June 13th, 2003, 04:16 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:19 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.