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! Best Practices in Integrated Requirements Management

    Poor Requirements Management capabilities in an Enterprise have been linked to excessive project failures, escalating IT costs, and failure to deliver competitive advantage into the marketplace. Join Brianna M Smith from IBM Rational and learn about how successful organizations align IT and Business stakeholders through collaborative processes and tools for effective requirements management, and how an integrated approach across the IT lifecycle can provide unparalleled visibility and traceability to ensure that project teams are delivering on the business vision by "doing the right things" and "doing things right."
    FREE! Go There Now!


    NEW! Download DB2 9.5 for Linux, Unix, and Windows

    Download a free trial version of IBM DB2 9.5 for Linux, UNIX, and Windows. DB2 9 is the result of a five-year development project that transformed traditional (static) database technology into an interactive data server that merges the high performance and ease of use of DB2 with the self-describing benefits of XML.
    FREE! Go There Now!


    NEW! IBM Enterprise Modernization Sandbox for System z: Architecture

    Analysts, architects, and developers who have existing COBOL or PL/I skills and want to extend those skills to deploy new workloads on the mainframe can use the IBM Enterprise Modernization Sandbox for System z to find hands-on walkthroughs of common real world scenarios. The scenarios provide examples of how to rapidly design, create, assemble, test, and deploy high-quality Web, Web services, portal, and SOA applications for IBM CICS, IBM IMS, and IBM WebSphere Application Server.
    FREE! Go There Now!


    NEW! IBM Rational Systems Development e-Kit

    As systems increase in complexity, communication between systems and software teams becomes more and more difficult. Now, there’s a way to improve product quality and communication.<br />Read the “Model Driven Systems Development” white paper to see how. Also included in this kit are more educational white papers, customer examples, tutorials, informative Webcasts, and best practices for designing, building and managing systems.<br />
    FREE! Go There Now!


    NEW! Improve your build process with IBM Rational Build Forge, Part 1: Create a continuous build and integration environment

    Learn how to implement a build management system that uses and extends your existing automation technologies. This tutorial shows, step-by-step, how to install and configure IBM Rational Build Forge to manage builds for Jakarta Tomcat from source code.
    FREE! Go There Now!


    NEW! Rational Modeling Extension for Microsoft.Net

    Rational Modeling Extension for Microsoft .NET enhances usability for code generation supporting a more intelligent refactoring. The latest enhancements enable organizations with Java and .NET systems and software development maintain architectural integrity across heterogeneous platforms.
    FREE! Go There Now!


    NEW! Successful Change and Release Management for .NET

    Join this webcast to discover the key requirements for successful change and release management. Learn how to extend your .NET environment to improve productivity and collaboration, and address core problems afflicting team development. In this webcast, we’ll review typical challenges faced by customers and how to resolve them with the IBM Rational Change and Release Management solution, including Rational ClearCase, Rational ClearQuest and Rational Build Forge. Replay is available for 9 months.
    FREE! Go There Now!


    NEW! The role of integrated requirements management in software delivery

    This paper is about the critical role that a discipline called integrated require­ments management can play in helping to ensure that your business goals and IT investments are continuously aligned—whether you are sourcing, integrat­ing, building or maintaining software. It also looks at ways that automated IBM Rational® products can work together to help you use requirements in the very best way.
    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!


    NEW! Trial download: IBM Rational Manual Tester V7.0.1

    Try the latest version of IBM Rational Manual Tester V7.0.1 by downloading a free trial from IBM developerWorks. This manual test authoring and execution tool promotes test step reuse to reduce the impact of software change on testers and business analysts and addresses the needs of teams performing at least a portion of their testing manually.
    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...
    - Conditional DataGrid Item and using checkbox...
    - Fill .NET Listbox with SQL DataReader
    - Filling Dropdown box using Code-Behinds in C#
    - FLAMES code sample written in .NET What is F...
    - Format Date/Time in a console app class





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