display image from MS Access Database using HTML / ASP
Hi
I've ms database where I've added one image(one so far for testing). Also in that DB(database) I have UserID and ItemID. Image I've added to DB (.mdb format) manually as OLE object. (It was : right click on DB field / Insert Object / from file/ picked up a picture / ok / done)
Now.. I'm trying to display that picture to a webpage using ASP code. The code I'm using to "pull" that image out is
'Declare Variables..
Dim sql
Dim rs
Dim conn
'Instantiate Objects
Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
'Open connection
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("GUDB.mdb")
'Get the specific image based on the ID passed in a querystring
str = "SELECT fil FROM Items"
rs.Open str, conn,3,3
if rs.eof then 'No records found
Response.End
else 'Display the contents
Response.ContentType = "image/bmp"
Response.BinaryWrite(rs("fil"))
end if
'destroy the variables.
rs.Close
conn.Close
set rs = Nothing
set conn = Nothing
to display that pulled out picture on the next page I use
<IMG SRC="gal.asp">
But nothing happens... I've tested piece of code that pulls image out from DB - it works, the code finds it, but obviously can pass that to a next page where second small part of code should handle it. The small part of the code for displaying that JPG (or BMP - I've tried both) displays tiny icon with 3 color circles in it - what suppose to be a picture I guess....
Any help would be great .. :-) Thanks!
Related Article: Client-side web & ms access solution
is a Web Design, HTML and CSS discussion thread by bdolla that has 5 replies, was last updated 1 year ago and has been tagged with the keywords: html, javascript, access, database.
vindom
Light Poster
47 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Self-Answered as of 1 Year Ago