Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." 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 Basics 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 October 21st, 2004, 07:42 PM
Registered User
 
Join Date: Oct 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Display results from DB as hyperlinks

I am very new to ASP but trying to learn, so any help is appreciated.

I am trying to create an asp page which will display results from a SQL Server database in an HTML table. The results (recordsets) to appear as hyperlinks to word documents. I know how to create a connection to a database but unclear on the other stuff.

 
Old October 21st, 2004, 08:03 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default


Hi,

  When you are retrieving data from database, form a hyperlink using

.....
while not Rs.EOF
strHTML=strHTML & "<a href='" & filename.doc & "'>" & filename.doc & "</a>"
   Rs.movenext
wend

finally print that strHTML

response.write strHTML


----------
Rajani

 
Old October 21st, 2004, 08:52 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

To put each link in a table row (this asumes you have the filenames in your table, RS(0) is the record containing the filename):

<% if NOT RS.Eof then
         response.write "<table>"
         do until RS.EoF
         response.write "<tr><td><a href='" & RS(0) & "'>" & RS(0) & "</a></td></tr>"
         RS.MoveNext
         loop
          response.write "</table>"
     Else
         response.write "<table><tR><td>The record set is empty</td></tR></table>"
     End If %>


Wind is your friend
Matt
 
Old October 23rd, 2004, 11:31 PM
Registered User
 
Join Date: Oct 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the reply...very helpful to a newbie like me.



Quote:
quote:Originally posted by mat41
 To put each link in a table row (this asumes you have the filenames in your table, RS(0) is the record containing the filename):

<% if NOT RS.Eof then
         response.write "<table>"
         do until RS.EoF
         response.write "<tr><td><a href='" & RS(0) & "'>" & RS(0) & "</a></td></tr>"
         RS.MoveNext
         loop
         response.write "</table>"
     Else
         response.write "<table><tR><td>The record set is empty</td></tR></table>"
     End If %>


Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
display results carswelljr ASP.NET 2.0 Basics 1 April 19th, 2007 09:46 AM
Display dB results in pyramid with asp.net 2.0 jlippiner Classic ASP Databases 0 May 26th, 2005 01:04 PM
How do I display search results... aspiretech9 PHP How-To 1 April 26th, 2005 10:12 AM
How do I display search results... aspiretech9 Beginning PHP 1 April 25th, 2005 04:59 PM
How do I display search results... aspiretech9 PHP Databases 1 April 25th, 2005 12:11 PM





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