Solved

ASP + creating hyperlink to data

Posted on 2003-11-04
1
216 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
1 Comment
 
LVL 58

Accepted Solution

by:
Gary earned 75 total points
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now