Solved

ASP + creating hyperlink to data

Posted on 2003-11-04
1
232 Views
Last Modified: 2008-02-26
Im my table below I'd like to have the "id" field- objRS.Fields("id") be a link to the information that is stored in my database.

How do I get this hyperlink to show the what is stored in database for the particular row where "id" is the unique key for the row?

This is what I have right now.

<a href="content.asp?article=<%=objRS.Fields("id")%>"><%=objRS.Fields("subject")%></a></td>

Don't worry about the datasebase connection line since I have that set up as an include and is working.

Full Code
___________________________________________________________________


<%Language=VBScript%>

<%
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "Select id, News_date, subject, News_to, DATEADD(day, 15, News_date) AS recentdate FROM news WHERE DateDiff(day,News_date,GetDate())<=15 and News_date <= getdate() ORDER BY News_date desc",cn  
 
%>
 
 
<table width="100%" border="0" cellspacing="4" cellpadding="2">
<tr>
<td valign="top"><table width="100%" border="0" cellpadding="3" cellspacing="1" class="bg01">
<tr>
<td colspan="4" valign="top" class="bg05"><strong><font size="2">October 2003</font>
</td>
</tr>
<tr>
<td width="7%" valign="top" class="bg02"><strong>Date</strong></td>
<td width="43%" valign="top" class="bg02"><strong>Subject</strong></td>
<td width="47%" valign="top" class="bg02"><strong>Audience</strong></td>
</tr>
<%Do until objRS.EOF
%>
<tr class="bg03">
<td valign="top"><%=objRS.Fields("News_date")%></td>
<td valign="top"><a href="content.asp?article=<%=objRS.Fields("id")%>"><%=objRS.Fields("subject")%></a></td>
<td valign="top"><%=objRS.Fields("News_to")%></td>
</tr>


<% objRS.MoveNext
%>
<%
Loop
objRS.Close
%>
</table></td>
</tr>
</table>
0
Comment
Question by:Lukeskywalker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 58

Accepted Solution

by:
Gary earned 75 total points
ID: 9679532
In content.asp

<%
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "Select * FROM news WHERE id="& request("article"),cn  
%>
Then just iterate through the fields
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question