ASP and Access database

R

Rob

See below...
-----Original Message-----
Hello

I have an access database, and i have linked it to my web
page using Front Page. Maybe this is more of a front
page question, but how do i make the link active on
the .asp page, right now it appears as normal text.

It is a bit unclear what you are asking here. What
exactly are you trying to link to?

Also, is it at all possible to have the page actually
display a picture based on the path held in the
database???

Assuming you mean the 'path' is a value held in a text
field in a table, yes, you can do this. Open up a
recordset to get at the record(s), and use Response.Write
to "print" the field's value into the HTML stream.
Roughly, and without a loop for handling multiple records,
it might look something like this:

<%Dim dbName, dbPath, strDSN, strSQL, conn, rs1
dbName = "mydata.mdb"
dbPath=server.mappath(dbName)
set conn = server.createobject("adodb.connection")
strDSN="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
dbPath
conn.Open strDSN
strSQL="Select * From tblWhatever WHERE ???????"
Set rs1 = Conn.Execute(strSQL)
Response.Write "<img src='" & rs1("PathField") & "'>"
rs1.Close
Set rs1 =Nothing
Set conn = Nothing
Set strSQL = Nothing
Set strDSN = Nothing
Set dbPath = Nothing
Set dbName = Nothing
%>

The important thing remember is the value in the PathField
needs to be the relative path as far as the Web Page is
concerned, not what the complete path is on your local
drive; e.g. "images\mypic.jpg" and
not "C:\whatever\images\mypic.jpg"

Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top