Wrox Programmer Forums
|
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 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 July 28th, 2003, 03:24 PM
Registered User
 
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Kelly Johnson
Default Hyperlink from Database

I'm trying to create a hyperlink from a field that I have pulled from a database. Below is my code, I hope someone can help.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("pgm") <> "") Then
  Recordset1__MMColParam = Request.QueryString("pgm")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_MISWork_STRING
Recordset1.Source = "SELECT Item, Tower, pgm, user FROM Inventory WHERE pgm = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="98%" border="1">
  <tr>
    <td width="17%"><div align="center"><strong>Item Number</strong></div></td>
    <td width="34%"><div align="center"><strong>Tower Number</strong></div></td>
    <td width="18%"><div align="center"><strong>Program</strong></div></td>
    <td width="31%"> <p align="center"><strong>User</strong></p></td>
  </tr>
  <%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
  <tr>
    <td><div align="center"><%=(Recordset1.Fields.Item("Item"). Value)%></div></td>
    <td><div align="center"><%=(Recordset1.Fields.Item("Tower") .Value)%></div></td>
    <td><div align="center"><a href=update.asp?<%=(Recordset1.Fields.Item("pgm"). Value)%>&">"</a></div></td> <td><div align="center"><%=(Recordset1.Fields.Item("user"). Value)%></div></td>
  </tr>
  <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset1.MoveNext()
Wend
%>
</table>
h
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>


 
Old July 28th, 2003, 06:04 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

 
Quote:
quote:<a href=update.asp?<%=(Recordset1.Fields.Item("pgm"). Value)%>&">"</a>

Well, you have to define a variable name and then assign a value from recordset.
Replace a quoted line with these lines:
Code:
<%
update_url="<a href=update.asp?pgm=" & Recordset1.Fields.Item("pgm").Value & ">"
update_url=update_url & Recordset1.Fields.Item("pgm").Value & "</a>"
Response.Write update_url
%>
...but the Soon is eclipsed by the Moon





Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperlink not a Hyperlink? SBCUser666 Access VBA 0 March 5th, 2008 07:01 PM
hyperlink kritimehrotra Excel VBA 3 July 24th, 2006 08:32 PM
hyperlink hyperlink sbhandar Classic ASP Basics 6 August 26th, 2004 02:04 AM
Hyperlink CW Classic ASP Databases 5 September 17th, 2003 06:45 AM
Hyperlink tgopal Javascript 2 July 4th, 2003 10:21 AM





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