How do I make a picture I have in an Access database be seen in a web page?
It is saved as an OLE object in the database. Thanks
Printable View
How do I make a picture I have in an Access database be seen in a web page?
It is saved as an OLE object in the database. Thanks
just put the path of your picture in your db!!
and do something like(when yu retrieve your record set)
<img src="<%=rs("picture")%>" border="0">
Wow that was simple!
And I was here going crazy. Darn 24-hour books. grrr...
Thanks a lot!!
But unfortunately it does not work when I have something like
While Not objRS.EOF
Response.Write "<img src="<%=rs("picture")%>" border="0"> "
objRS.MoveNext
Wend
I have a couple of them in the database! What can I do?
try this buddy..
Code:While Not objRS.EOF
Response.Write '<img src=' & rs("picture") & ' border="0"> '
objRS.MoveNext
Wend
Sorry guys but none of the ways youve given me seem to work;. Perhaps what I did wrong was the way I stored the pictures in the database. (theyre jpegs by the way)
I defined the field as an OLE object, then right clicked on it and selected insert object. Then I selected 'image' and browsed to the file. Do you know if my error is there?
How did you guys store the picture?
Is it better if its a gif?
According to Wrox - Profesional ASP 2.0 an image can be displayed in an asp page with the following code.
<%@ Language=VBScript %>
<% 'Clear out the existing HTTP header information
Response.Expires=0
Response.buffer=true
Response.Clear
'Change the HTTP header to reflect that an image is being passsed
Response.ContentType="image/gif"
set cn=Server.CreateObject("ADODB.Connection")
cn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=pubs;Data Source=isd03"
set objRs = cn.Execute("select logo from pub_info where pub_id = '0877'")
Response.BinaryWrite(objRs("logo"))
Response.End
%>
It works for me intermitently, may you would have more luck or someone else can help with soem refinements.
Sorry I can't help you specifically...
I cannot use
Response.ContentType="image/gif"
because I have numers, text and pictures in the recordset. I want to display the text and the picture that matches the query.