Solved

ASP + creating hyperlink to data

Posted on 2003-11-04
1
221 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
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
UTC (timezone) without using an API 16 46
How to display the different types of results from a Query 2 45
Choose the older file FSO 6 47
Time Conversions...both ways 2 15
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

776 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