Displaying images from an Access Database

K

kbrad

I have an Access database set up with a number of text fields and a hyperlink
field which references a different image per record. I am trying write ASP
code to retrieve allt his data and images onto a web page. I have the data
but the images are causing a problem.
The code I am using is as follows:
For the data:
<TD><P><FONT COLOR="#000000"><% Response.Write rsRecordset("Fieldname")
%></FONT></TD>
This is fine.
For the images:
<TD><P><FONT COLOR="#000000"><img src=<% Response.Write
rsRecordset("ImageFieldName") %>> </FONT></TD>
With this I get the square with the little red cross in it.
I have managed to get the image to appear by hard coing the link I have in
one of my database fields but that isn't what I want.
Can anyone help?
 
M

Mike Brind

kbrad said:
I have an Access database set up with a number of text fields and a hyperlink
field which references a different image per record. I am trying write ASP
code to retrieve allt his data and images onto a web page. I have the data
but the images are causing a problem.
The code I am using is as follows:
For the data:
<TD><P><FONT COLOR="#000000"><% Response.Write rsRecordset("Fieldname")
%></FONT></TD>
This is fine.
For the images:
<TD><P><FONT COLOR="#000000"><img src=<% Response.Write
rsRecordset("ImageFieldName") %>> </FONT></TD>
With this I get the square with the little red cross in it.
I have managed to get the image to appear by hard coing the link I have in
one of my database fields but that isn't what I want.
Can anyone help?

1. Do a View Source, and look at the results from
rsRecordset("ImageFieldName"). You might see the problem that way.
2. Right click on the redex and look at its properties. That's another
way to track down the problem.

Let us know what you find. If you can't resolve the problem, give us a
sample of the contents of rsRecordset("ImageFieldName")
 
K

kbrad

When I do View Source as suggested I see
<img src =#http://pcname/directory/imageName.jpg#>
Are the # signs causing a problem? If so how do I get rid of them?

When I hard code http://pcname/directory/imageName.jpg into the code I do
get the correct image so it does recognise the path.

When I right click the redex I see the file name with # at the end at the
top of the properties box ie. imageName.jpg#
Also the Address: is
http://pcname/directory/TMPi8f7xda7h.asp#http://pcname/directory/imageName.jpg#
Do you think this is right?
 
M

Mike Brind

No, it's not right. I don't know where you are getting the hash/pound
marks from. Have a look at your database table and see if they are
there. If they are, then they must get there when you enter the data.


The best way to get rid of them is go into the raw data and delete
them, but if you can't, then you have to use replace() to get rid of
them:

<img src="<% = replace(rsRecordset("ImageFieldName"),"#","")%>">

Incidentally, you forgot to put " before and after the image filename.
That won't help either.
 
B

Bob Lehmann

I don't know where you are getting the hash/pound marks from.

He's probably using Access's hyperlink "data type". Possibly useful in
access, but completely useless anywhere else.

Bob Lehmann
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top