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

ID: Q187823

The information in this article applies to:

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 98. 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, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft Support professionals 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 needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/supportnet/refguide/ 

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 filed 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>"

Additional query words: 98
Keywords          :  
Version           : WINDOWS:98
Platform          : WINDOWS
Hardware          : x86
Issue type        : kbhowto

Last Reviewed: May 19, 1999