FP98: How to Return Plain Text as a URL from a Database (187823)



The information in this article applies to:

  • Microsoft FrontPage 98 for Windows

This article was previously published under Q187823

SUMMARY

This article explains how to return plain text as a hyperlink by modifying the Database Region Wizard code that is generated by Microsoft FrontPage. For example, if you have a database that contains e-mail addresses that are stored in the format of 'example@microsoft.com,' you can return that data as a live hyperlink by using the FrontPage Database Region Wizard.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
  1. In FrontPage Explorer, right-click the .asp file that contains the query that returns the results of a search and click Open With.
  2. In the Open With Editor dialog box, click Text Editor (Notepad.exe).
  3. In the code for the .asp page, find the line that writes the text for the field that you want to return as a Uniform Resource Locator (URL).

    Example 1

    If you want to return a field titled "email" the code would be similar to the following:
    If Not IsEmpty(fp_rs) And Not (fp_rs Is Nothing) Then
    Response.Write CStr(fp_rs("email"))
    						

    Example 2

    If you want to return a field titled "links" the code would be similar to the following:
    If Not IsEmpty(fp_rs) And Not (fp_rs Is Nothing) Then
    Response.Write CStr(fp_rs("links"))
    						

  4. Modify the code so that the Response.Write procedure adds the HTML code for a hyperlink:

    Example 1:

    To return the "email" field as a mailto hyperlink, change the code to the following:
    If Not IsEmpty(fp_rs) And Not (fp_rs Is Nothing) Then Response.Write
    "<a href='mailto:" & CStr(fp_rs("email")) & "'>" &
    CStr(fp_rs("email")) & "</a>"
    						

    Example 2:

    To return the "links" field as an HTTP hyperlink, change the code to the following:
    If Not IsEmpty(fp_rs) And Not (fp_rs Is Nothing) Then Response.Write
    "<a href='http://" & CStr(fp_rs("links")) & "'>" &
    CStr(fp_rs("links")) & "</a>"
    						

Note: The method described in this article is not neccessary for FrontPage 2000.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbhowto KB187823