ASP Code
  Home arrow ASP Code arrow How to write out hyperlink from a Recordse...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP CODE

How to write out hyperlink from a Recordset, then click the hyperlink to view a complete listing of
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    1999-09-01

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Here is the code used in the demo!

    Page One - The page that shows a table like the one above.

    <%@ Language = "VBScript"%>
    <%
    response.buffer = true
    On Error Resume Next
    strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("hyperlinkdemo.mdb")
    'Declare all variables
    dim conn
    dim rs
    dim strID
    dim strconn
    dim strsql
    'Setup connection and recordset objects
    set conn = server.createobject("adodb.connection")
    conn.open strconn
    set rs = server.createobject("adodb.recordset")
    'Define your sql statement that will retrieve the data
    strSql = "SELECT tblMemberInfo.EmpID tblMemberInfo.EmailAddress tblMemberInfo.Link_to_Homepage" & _
    " FROM tblMemberInfo WHERE (((tblMemberInfo.Link_to_Homepage) LIKE '%http://%'" & "))" & _
    " ORDER BY tblMemberInfo.EmpID"
    'Open the Recordset object and retrieve data
    rs.open strsql conn
     
    'Standard Error Coding
    If err.number <> 0 Then
    Response.Redirect "Error.asp?number=" & err.Number & "&desc=" & Server.URLEncode(err.description)
    End If
    %>
    <% rs.movefirst %>
    <html>
    <head>

    <title>
    Template Page</title>
    </head>
    <body>
    <table BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="390" height="63">
    <tr>
    <td height="24"><font face="Verdana"><big><big><strong>Example List of people w/Their email address's and Favorite homepage links <br>These links are dynamically generated from data into the Database.</strong></big></big></font></td>
    </tr>
    </table>
    <TABLE BORDER="1" width="80%">
    <TR>
    "Write out the header info
    <% For Each Field In RS.Fields %>
    <TH> <% If Field.Name <> "MemberID" Then
    response.write Field.name
    End If %> </TH>
    <% Next %>
    Write out the data info!
    </TR>
    <% Do While Not RS.EOF %>
    <TR>
    <% For Each Field In RS.Fields %>
    <TD ALIGN=center>
    <% If IsNull(Field) Then
    Response.Write ""
    ElseIf Field.Name = "EmpID" Then
    Response.Write "<a href='http://" & Request.Servervariables("Server_Name") & "/asp/demos/Profile.asp?EmpID=" & rs("EmpID") & "&EmailAddress=" & rs("EmailAddress") & "'>" & Field.Value
    ElseIf Field.Name = "EmailAddress" Then
    response.write "<a href=mailto:" & field.value & ">" & Field.Value & "</a>"
    ElseIf Field.Name = "Link_to_Homepage" Then
    response.write "<a href='javascript:void(0);' onClick=window.open('" & field.value & "')>" & Field.Value
    Else
    Response.Write Field.Value
    End If %>
    </TD>
    <% Next
    RS.MoveNext %>
    </TR>
    <% Loop %>
    </TABLE>
    <% Rs.Close
    Set Rs = Nothing %>
    <p>&nbsp;</p>
    </body>
    </html>
    <%
    conn.close
    set conn = nothing
    %>

    Page 2 The Profile Page that shows the complete info on the person that was chosen!

    <%@ Language = "VBScript"%>
    <%
    response.buffer = True
    On Error Resume Next
    'Declare all local variables
    dim conn
    dim rs
    dim strID
    Dim strZoneName
    Dim StrEmailAddress
    Dim StrRowSpan
    dim StrImageInfo
    dim strconn
    strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("hyperlinkdemo.mdb")
     
    'Pick values up from the url
    strEmpID = request("EmpID")
    strEmailAddress = request("EmailAddress")
    'Set connection String and recordset objects to bring back member info from db
    set conn = server.createobject("adodb.connection")
    conn.open strconn
    'Standard Error coding
    If err.number <> 0 Then
    Response.Redirect "Error.asp?number=" & err.Number & "&desc=" & Server.URLEncode(err.description)
    End If
    set rs = server.createobject("adodb.recordset")
    strSql = "select tblMemberInfo.EmpID tblMemberInfo.EmailAddress tblMemberInfo.Link_to_Homepage" & _
    " FROM tblMemberInfo" & _
    " WHERE (((tblMemberInfo.EmpID)='" & strEmpID & "')" & " AND ((tblMemberInfo.EmailAddress)='" & strEmailAddress & "'))"
    rs.open strsql conn
    'Standard Error Coding
    If err.number <> 0 Then
    Response.Redirect "Error.asp?number=" & err.Number & "&desc=" & Server.URLEncode(err.description)
    End If
    'Sets local variables to help write out the table
    strRowSpan = rs.fields.count + 1
    strImageInfo = rs("path_to_image")
    %>
    <html>
    <head>
    <title>Profile Page</title>
    </head>
    <body>
    <h1>The Profile you chose is for:<% = strEmpID %>
    <form>
    <TABLE BORDER="1">
    <tr><td BGCOLOR="FFFFFF" rowspan="<% = StrRowSpan %>">
    <%
    'Determines if an image is in the database or not if so it writes out the path
    If strImageInfo <> "" Then
    response.write "<img src='" & strImageInfo & "'></td>"
    Else
    response.write "<h4>No Picture Provided</h4></td>"
    End If
    %>
    </tr>
    <%
    'Writes out the info on the player based on the info in the database
    Do While Not RS.EOF %>
    <% For Each Field In RS.Fields %>
    <tr>
    <TD ALIGN="Left">
    <%
    response.write Field.Name & ":</td><td><input type='text' name='" & field.name & "' length='140' value='" & Field.Value & "'></TD></TR>" %>
    <% Next
    RS.MoveNext %>
    <% Loop %>
    </TABLE></form>
    <p>&nbsp;</p>
    </body>
    </html>
    <%
    'Sets the objects to nothing to help clean up objects in servers memory
    set rs= nothing
    set conn = nothing
    %>

    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More ASP Code Articles
    More By aspfree

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! IBM – Taking Web 2.0 to Work

    David Barnes, Lead Evangelist for IBM Emerging Internet Technologies will discuss aspects of Web 2.0 that bring value to corporations, academia, and government. He'll also discuss IBM's vision around Web 2.0, including the importance of remixability and consumability. The discussion will culminate with examples of various IBM Software Group solutions you can use to get ahead of the Web 2.0 adoption curve.
    FREE! Go There Now!


    NEW! Accelerating Software Innovation on i on Power Systems

    Attend this launch webcast with Scott Hebner, Vice President of IBM Rational Marketing and Strategy, for an overview of Rational’s new software offerings and resources to help modernize and accelerate software innovation on i on Power Systems – while ensuring past application investments are protected and continue to grow. Learn how these solutions are helping customers extend their core i5/OS solutions toward modern architectures such as SOA and web technologies to deliver business improvements that stand the test of time.
    FREE! Go There Now!


    NEW! Application Development Tools for the Mainframe Developer

    You probably have thousands of lines of COBOL code loaded with business intelligence and being used to run your business, along with an army of developers maintaining these applications. Learn how to prepare your applications and developers so you can keep that competitive edge and move to a service-oriented architecture with the IBM Rational Enterprise Modernization solutions. Replay is available for 9 months.
    FREE! Go There Now!


    NEW! Evaluate Rational Host Access Transformation Services (HATS) Toolkit V7.1

    Visit IBM developerWorks to download a free trial of the Rational Host Access Transformation Services (HATS) Toolkit. The HATS toolkit provides a set of plug-ins for the IBM Rational Software Delivery Platform to help you easily extend your legacy applications. HATS makes your 3270 and 5250 applications available as HTML through the most popular Web browsers, while converting your host screens to a Web look and feel and it also enables you to develop new Web, portal, and rich-client applications.
    FREE! Go There Now!


    NEW! Hello World: WebSphere Service Registry and Repository

    Manage, govern, and share services across your organization by using WebSphere Service Registry and Repository. Follow the hands-on exercises to learn how to navigate the Web interface to publish, find, reuse, and update services.
    FREE! Go There Now!


    NEW! IBM Rational AppScan Standard Edition V7.7

    Secure your Web applications with IBM Rational AppScan Standard Edition V7.7, previously known as Watchfire AppScan. This Web application security testing tool automates vulnerability assessments and scans and tests for common Web application vulnerabilities. Visit IBM developerWorks to download a free trial of IBM Rational AppScan Standard Edition V7.7.
    FREE! Go There Now!


    NEW! Info 2.0: Harnessing the power of Web 2.0 and Enterprise Mashups

    Listen to this webcast to get an overview of Info 2.0 and a technical demo of how to quickly build an enterprise mashup. IBM's Info 2.0 technology leverages emerging Web 2.0 technologies such as mashups, feeds, AJAX, and JSON in order to simplify assembly of information using feeds and services. Come learn about the technical elements of Info 2.0 including the Feed Generation framework, Mashup Engine, and mashup assembly components. Learn how to pull information from databases, departmental information, and the Web to create mashups critical to your company’s success. We will also discuss best practices to help you get started.
    FREE! Go There Now!


    NEW! Krugle, developerWorks, and code search

    Ken Krugler, co-founder of code search company Krugle, and Laura Merling, vice president of Marketing and Business Development for Krugle, join to talk about the ins and outs of code search and what it means as a new feature for developerWorks users.
    FREE! Go There Now!


    NEW! Software Change and Configuration Management Solution Guidelines

    This whitepaper provides areas to consider when evaluating any software configuration management solution. It addresses how the IBM solutions (Rational ClearCase and Rational ClearQuest) meet the needs and requirements of both project leaders and developers to provide successful Software Change and Configuration Management.
    FREE! Go There Now!


    NEW! Trial download: IBM Informix Dynamic Server Express Edition V11.0

    Informix Dynamic Server (IDS) Express Edition offers outstanding online transaction processing (OLTP) database performance, while helping to simplify and automate many of the tasks associated with deploying databases for small business applications. IDS 11 further extends the ease of management and applications integration with the Admin API and Scheduler, high availability with Continuous Log Restore for backup server recovery in case of a primary server failure, and column level encryption to protect personal and company private data.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    ASP CODE ARTICLES

    - ASP Forms
    - ASP: The Beginning
    - Getting Remote Files With ASP Continued
    - Inbox and Outbox Manipulation in ASP
    - Relational DropDownList Using VB.NET
    - Ad Tracking URL Hits
    - Use ViewState to display one record per page...
    - Send Email using ASP.NET formatted in HTML
    - ASP File Explorer
    - ASP/XML Interview questions by Srivatsan Sri...
    - Pressing RETURN won't submit the form
    - This shows how you get the TEXT of a combo r...
    - Group Data by Adrian Forbes
    - Multiple checkbox select sample
    - Multiple checkbox select with all values sam...





    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek