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! 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! Applying lean thinking to the governance of software development

    Effective governance for lean development isn’t about command and control. Instead, the focus is on enabling the right behaviors and practices through collaborative and supportive techniques. Hear from Scott Ambler on how it is far more effective to motivate people to do the right thing than it is to force them to do so. Learn how to form a lightweight, collaboration-based framework that reflects the realities of modern IT organizations.
    FREE! Go There Now!


    NEW! Cook up Web sites fast with CakePHP, Part 4: Use CakePHP&apos;s Session and Request Handler components

    CakePHP is a stable production-ready, rapid-development aid for building Web sites in PHP. This "Cook up Web sites fast with CakePHP" series shows you how to build an online product catalog using CakePHP.
    FREE! Go There Now!


    NEW! Harnessing the power of SQL and Java for high performance data access

    Join this webcast to see how IBM Data Studio Developer and pureQuery can take the pain out of Java data access. uApplications developed using both Java and SQL have become a common requirement. Database connectivity using Java Database Connectivity (JDBC) to create an application is a multi-step tedious process, and tooling that covers both SQL and Java has been unavailable, until now. IBM Data Studio introduces the pureQuery platform: a high-performance, Java data access platform focused on simplifying the tasks of developing, managing, and optimizing database applications and services.
    FREE! Go There Now!


    NEW! IBM Enterprise Modernization Sandbox for System z

    IBM Enterprise Modernization solutions help organizations evolve core IT systems towards modern architectures and technologies—reducing the burden of maintenance and freeing up resources to develop new business requirements and capabilities. With the IBM Enterprise Modernization Sandbox for System z you can evaluate IBM Enterprise Modernization solutions focused on five key areas: Assets, Architectures, Skills, Processes and Infrastructures, and Investment. Each solution is based upon real customer experiences and offers a proven path to get you started with your modernization projects.
    FREE! Go There Now!


    NEW! Rational Talks to You: Grady Booch on Architecture

    Join this Rational Talks to You teleconference on November 29 at 1:00 pm ET to participate in an interactive discusssion with Grady Booch around architecture and reuse. Get your questions answered!
    FREE! Go There Now!


    NEW! Webcast: Calling All Testers! Find Application Vulnerabilities Early in the Development Process Where they are Easier to Fix and Less Risky to your Business

    In this webcast, IBM Rational will discuss the importance of Web application security and will share techniques and best practices to introduce application security testing into current QA processes including: understanding common security vulnerabilities and techniques to integrate security testing with defect tracking and remediation systems in an effort to safeguard sensitive online information.
    FREE! Go There Now!


    NEW! Webcast: Striking the right balance between manual and automated testing

    Join this webcast to learn how IBM Rational's Functional Testing solution enables you to implement automation your way, at your pace, with your existing staff. In this webcast, you’ll learn how you can eliminate redundancy of manual test scripts, reduce errors, and increase test coverage through test automation. After this presentation you will understand how IBM Rational Functional Testing solution can streamline your manual testing and make test automation easily attainable.
    FREE! Go There Now!


    NEW! Webcast: WebSphere Process Server

    WebSphere Process Server delivers a unique integration framework that simplifies existing IT resources. Often, as IT assets grow to support business demand, so too does their complexity and manageability. In this webcast, we’ll discuss how WebSphere Process Server helps deliver an SOA infrastructure that provides a common model to orchestrate, mediate, connect, map, and execute the underlying IT functions. Discover how WebSphere Process Server simplifies integration of business processes by leveraging existing IT assets as reusable services without the complexities of traditional integration methodologies.
    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...





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