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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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!


    Check out the new Jazz space on developerWorks

    <a href="http://zeus.developershed.com/shonuff.php?blackbird=3853&zoneid=442&source=&dest=http%3A%2F%2Fwww.ibm.com%2Fdeveloperworks%2Fspaces%2Fjazz%3FS_TACT%3D105AGY31%26S_CMP%3DDEVSHED&ismap="><img src="http://images.devshed.com/corp/img/news/jazz01.gif" alt="developerWorks Jazz space" align="left"></a>You've heard the buzz about Jazz... want to know more about it from a developer's perspective? Check out the Jazz space on developerWorks. This space is an up-to-date resource for developers, including technical information about Jazz and products built on Jazz, like Rational Team Concert Express. The Jazz space includes content from a wide variety of sources, including links, feeds, and comments from experts.
    FREE! Go There Now!


    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! Build Web services with transport-level security using Rational Application Developer V7, Part 1: Build Web services and Web services clients

    Build secure Web services with transport-level security using IBM Rational Application Developer V7 and IBM WebSphere Application Server V6.1. Follow this three-part series for step-by-step instructions about how to develop Web services and clients, configure HTTP basic authentication, and configure HTTP over SSL (HTTPS). This first part of the series walks you through building a Web service for a simple calculator application. You generate and test two different types of Web services clients: a Java Platform, Enterprise Edition (Java EE) client and a stand-alone Java client. You also handle user-defined exceptions in Web services.
    FREE! Go There Now!


    NEW! Download IBM Rational Developer for System z

    Download a free trial version of IBM Rational Developer for System z, software that can help you deliver core development capabilities; the power of Java Platform, Enterprise Edition (Java EE); and rapid application development support to diverse enterprise application development teams. With comprehensive development tools to help create, deploy and maintain traditional enterprise and composite applications, Rational Developer for System z enables developers with different technical backgrounds to easily participate in important technology projects.
    FREE! Go There Now!


    NEW! Download the free Web Application Security eKit

    Discover how IBM Rational AppScan Standard Edition can help you detext vulnerabilities in your web applications in the Web Application Security eKit. IBM Rational AppScan is a leading suite of automated web application security solutions that scan and test for common Web application vulnerabilities. The new Web Application Security eKit provides you with valuable resources, including white papers, demos, and additional information on the benefits of testing your Web applications.
    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! Project and Portfolio Management Executive Resource Kit

    Portfolio Management is about effectively managing portfolio value by aligning portfolio investments with business goals. This complimentary e-kit provides a collection of materials that can help you understand how IBM Rational enables and automates best practices for improved governance and clear visibility into portfolio and project performance across the entire IT project lifecycle.
    FREE! Go There Now!


    NEW! Rational Asset Manager eKit

    Learn how to do more with your reusable assets with the free Rational Asset Manager eKit. The eKit includes demos on how Rational Asset Manager tracks and audits your assets in order to utilize them for reuse. Plus you’ll find white papers and a Webcast that discuss the challenges of a Service Oriented Architecture and how Rational Asset Manager can provide quick and effective solutions.
    FREE! Go There Now!


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

    Get a free trial download of the latest version of IBM Rational Functional Tester V7.0.1. Rational Functional Tester is an automated functional and regression testing solution for QA teams concerned with the quality of their Java, Microsoft Visual Studio .NET, and Web-based applications.
    FREE! Go There Now!


    NEW! Webcast: Extreme transaction processing with WebSphere Extended Deployment

    In this webcast, you'll get an introduction to the eXtreme Transaction Processing (XTP) features of WebSphere Extended Deployment and the common architectural traits required by XTP applications. See how WebSphere Extended Deployment's ObjectGrid feature provides a state-of-the-art infrastructure for hosting XTP applications.
    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...
    - Various methods of setting Date values to a ...
    - 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...

     
    Application Delivery: Everything You Wanted to Know, but Didn`t Know You Needed to Ask
    A comprehensive guide to examining the topics of Wide-area Data Services and app....

     
    Best Practices: Safe and Secure Hardware Asset Recovery
    Companies increasingly must meet EPA and local requirements for the disposal of ....

     
    Managing SSL Security in Multi-Server Environments
    Read this white paper to learn how to simplify management of your organization's....

     
    Open Source Security Myths
    Open Source Software (OSS) is computer software whose source code is available t....

     
    Power and Cooling Capacity Management for Data Centers
    This paper describes the principles for achieving power and cooling capacity man....

     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT