Need field containing hyperlinks when generating l

Results 1 to 4 of 4

Thread: Need field containing hyperlinks when generating l

  1. #1
    Ilonka N. Sjak-Shie Guest

    Default Need field containing hyperlinks when generating l

    Hi, I am a beginner in asp. Have managed to dynamically list the data from a database table. However, one of the fields in my Access database is supposed to be a hyperlink (just site URLs) and I have searched endlessly to find out how to do this. The field just comes in as text. I know you can add the &#060;td&#062;&#060;a href="http://:&#062; to get a hyperlink, but I do not get how to do it to one field alone. I found one example where you can specify special formats for dates, monetary figures etc, but not a hyperlink so that did not work. Hope this makes sense. Can someone please put me in the right direction. Much appreciated.<BR><BR>Ilonka

  2. #2
    Ilonka N. Sjak-Shie Guest

    Default RE: Need field containing hyperlinks when generati

    Sorry, its me again. Thought you may need the looping code :-)<BR>&#060;%<BR><BR>Function RecToTable(objRec)<BR><BR>Dim strT &#039table html string<BR>Dim fldF &#039current field object<BR><BR>&#039build the table header<BR><BR>strT = "&#060;TABLE BORDER = 1&#062;" &_<BR> "&#060;TABLE ALIGN = CENTER&#062;"<BR><BR>&#039 each field as a table column name<BR>For Each fldF In objRec.Fields<BR> strT = strT & "&#060;TD&#062;" & fldF.Name & "&#060;/TD&#062;"<BR>Next<BR>strT = strT & "&#060;/TR&#062;"<BR><BR>&#039now build the rows<BR>intFields = objRec.Fields.Count - 1<BR>While not objRec.EOF<BR> strT = strT & "&#060;TR ALIGN CENTER&#062;"<BR> <BR> &#039loop through the fields<BR> For each fldF in objRec.Fields<BR> strT = strT & "&#060;TD&#062;" & fldF.Value & "&#060;/TD&#062;"<BR> Next<BR> strT = strT & "&#060;/TR&#062;"<BR> objRec.MoveNext<BR>Wend<BR>strT = strT & "&#060;/TABLE&#062;"<BR><BR>&#039 and finally return the table<BR>RecToTable = strT<BR><BR>End Function<BR><BR><BR>%&#062;<BR><BR>Thanks :-) By the way...GREAT SITE.

  3. #3
    Jason Buck Guest

    Default RE:HYPERLINKING

    say you have a link table where you just have user submit there favorite URLs.<BR><BR>tblURLs<BR>field1: URLID (AUTONUMBER)<BR>field2: URLADDRESS (TEXT)<BR>field3: URLDESCRIPTION (TEXT)<BR><BR>CONNECT TO DATABASE<BR><BR>&#060;%<BR>strConnect = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:databaseurldb.mdb"<BR><BR>dim objconn, objrec, mysql, strStatus, Mytest, strLength<BR>set objconn = server.createobject("ADODB.Connection")<BR><BR>obj Conn.open strConnect<BR><BR>mysql = "SELECT tblURLs.URLADDRESS, tblURLs.URLDESCRIPTION FROM tblURLs"<BR>set rstemp = objConn.execute(mysql)<BR><BR>response.write "&#060;table&#062;"<BR><BR>&#039GO THROUGH ALL OF THE RECORDS IN THE TABLE<BR>If not rstemp.eof then<BR><BR> Do While Not rstemp.EOF<BR>strURLADDRESS = rstemp("URLADDRESS")<BR>strURLDESCRIPTION = rstemp("URLDESCRIPTION")<BR><BR>&#039WRITE ALL OF THE LINKS<BR>response.write "&#060;tr&#062;&#060;td&#062;&#060;a href=&#039" & strURLADDRESS & "&#039&#062;" & strURLDESCRIPTION & "&#060;/a&#062;&#060;/td&#062;&#060;/tr&#062;"<BR><BR> <BR> rstemp.movenext<BR> Loop<BR>response.write "&#060;/table&#062;"<BR><BR><BR>End if<BR><BR>&#039CLOSE CONNECTION<BR>rstemp.close<BR>set rstemp = nothing<BR>objconn.close<BR>set objconn = nothing<BR><BR>%&#062;<BR><BR><BR>I hope that this code is clear enough for you.<BR><BR>If you have any further questions, feel free to contact me.<BR><BR>Respectfully,<BR><BR>Jason<BR>webmaster @wnj.com<BR>

  4. #4
    Jason Buck Guest

    Default RE: Need field containing hyperlinks when generati

    You should try to keep your code as simple as possible and together. WRITE YOU TABLE ROWS AND DATA ALL AT ONCE.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •