ASP and Access database

  • Thread starter Thread starter Mike S
  • Start date Start date
M

Mike S

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.

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

Thanks
 
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
 
In addition to Rob's advice, you must save the page with an .asp extension
and your webserver must be have ASP installed and active.
 
Back
Top