p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_howto thread: Retrieve URL stored in Access Database


Message #1 by "Errol Gaznabbi" <krittercam@n...> on Mon, 19 Mar 2001 20:28:07
Try :

<td><a
href=3D"<%=3DServer.HTMLEncode(rsMbrs.Fields("CourseOutline").Value%>">C
ours
e</a></td>

> -----Original Message-----
> From: krittercam@n... [mailto:krittercam@n...]
> Sent: 20 March 2001 17:19
> To: proasp=5Fhowto@p...
> Subject: RE: Retrieve URL stored in Access Database
>
>
> I'm doing a web database project for college, and this
> problem is really
> driving me crazy. I'm very pressed for time, and the sooner I
> get this
> problem solved, the better. Let me give you a little
> background first. I
> have a table in Access by the name of Course. This table contains two 

> attributes(columns), they are CourseID (text), and CourseOutline
> (hyperlink). The actual Course Outlines are Word
> documents(saved as HTML)
> which are stored in the same directory as the database.I need
> to be able
> display the URL's of the Course Outlines from the database
> onto the web
> page using ASP. Then by clicking on the displayed URL from
> the web page,
> the actual Course Outline document will be displayed. I
> cannot hard code
> links to the Course Outlines because I need the ability to make the
> changes additions or deletions in the database and have it
> reflected on
> the web page. The problem I'm having is that when retrieved from the
> database, the URL is not displayed, only the ASP code. I
> don't know if
> it's because of the hyperlink datatype in Access. All other
> fields work
> fine.I've pasted the actual code I'm using below. If you can
> help me with
> the specific code I need to get this working, I would be very
> grateful,
> since I'm very pressed for time. Thank you very much, your
> help is much
> appreciated.
>
> <html>
> <head>
> <title>Courses>
> <!-- #include file=3D=94adovbs.inc=94-->
>
> ' Open connection to Access database ClassWork.mdb.
> Set cnn1 =3D Server.CreateObject(=93ADODB.Connection=94)
> OpenStr =3D =93driver=3D{Microsoft Access Driver (*.mdb)};=94 & =5F
> 	       =93dbq=3D=94 & Server.MapPath(=93ClassWork.mdb=94)
>
> cnn1.Open openStr, =93 =94 =93 =94
> ' Open a recordset containing all fields from all records in
> Course table.
> sql =3D =93SELECT * FROM course;=94
> Set rsMbrs =3D Server.CreatObject(=93ADODB.Recordset=94)
> RsMbrs.Open sql, cnn1, adOpenForwardOnly, adLockReadOnly, adCmdText
> %>
>
> </head=3F
> <body>
> <table border =3D=941=94 cellspacing=3D=940=94 cellpadding=3D"3">
> 	<caption><b>Courses</b></caption>
> 	<tr>
> 		<th>CourseID</th>
> 		<th>CourseOutline</th>
> 	</tr>
> <% ' Begin looping through all records
> Do While Not rsMbrs.EOF
> %>
> ' Start a new table row.-->
> 	<tr valign=3D"TOP">
> <!-- Create two table cells that contain the values of CourseID, and
> CourseOutline. -->
>
> <td><%=3DServer.HTMLEncode(rsMbrs.Fields("CourseID").Value%></td>
> <td><%=3DServer.HTMLEncode(rsMbrs.Fields("CourseOutline").Value%></td>

> </tr>
>
> <%
> ' Move to next record.
> rsMbrs.MoveNext
> ' End of loop repeated once for each record.
> Loop
> ' Closw the recordser and discard the object.
> rsMbrs.Close
> set rsMbrs =3D Nothing
> ' Close the connection and discard the object.
> cnn1 =3D Nothing
> %>
> </table>
> </body>
> </html>
>
>
>
>
>
>
>
>
>
>
> > How are you returning it in your ASP, it should be something like :
> >
> > response.write("<a href=3D'" & results("myURL") & "'>" &
> > results("myTitle") & "</a>")
> >
>
> ---
> SoftArtisans helps developers build robust, scalable Web applications!

> Excel Web reports, charts:
http://www.softartisans.com/excelwriter.html
File uploads: http://www.softartisans.com/saf.html
Transactional file management: http://www.softartisans.com/saf1.html
Scalability: http://www.softartisans.com/saxsession.html
ASPstudio value pack: http://www.softartisans.com/aspstudiosuite.html
=2D--
gregory=5Fgriffiths@c...
leave-proasp=5Fhowto-34090R@p...



  Return to Index