|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Displaying images from an Access Database
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? kbrad wrote:
Show quote > I have an Access database set up with a number of text fields and a hyperlink 1. Do a View Source, and look at the results from> 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? 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") -- Mike Brind 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? Show quote "Mike Brind" wrote: > > kbrad wrote: > > > 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") > > -- > 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. -- Show quoteMike Brind kbrad wrote: > 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? > > > "Mike Brind" wrote: > > > > > kbrad wrote: > > > > > 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") > > > > -- > > Mike Brind > > > > Incidentally, how are you getting the image file names into the
database? -- Show quoteMike Brind Mike Brind wrote: > 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. > > -- > Mike Brind > > > > kbrad wrote: > > 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? > > > > > > "Mike Brind" wrote: > > > > > > > > kbrad wrote: > > > > > > > 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") > > > > > > -- > > > Mike Brind > > > > > > > I don't know where you are getting the hash/pound marks from. He's probably using Access's hyperlink "data type". Possibly useful inaccess, but completely useless anywhere else. Bob Lehmann Show quote "Mike Brind" <paxton***@hotmail.com> wrote in message http://pcname/directory/TMPi8f7xda7h.asp#http://pcname/directory/imageName.jpg#news:1144441053.880224.162710@t31g2000cwb.googlegroups.com... > 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. > > -- > Mike Brind > > > > kbrad wrote: > > 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 > > Show quote > > Do you think this is right? > > > > > > "Mike Brind" wrote: > > > > > > > > kbrad wrote: > > > > > > > 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") > > > > > > -- > > > Mike Brind > > > > > > > |
|||||||||||||||||||||||