Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_discuss thread: Database images


Message #1 by matthew.cochrane@d... on Fri, 23 Aug 2002 14:44:37
I'm sure there's a way of reading an image stored in Access and outputting 
the image as a file. However my ASP (below) doesn't work, it is supposed 
to generate the image as if it was a GIF itself.

The Include file contains the path to the database and the necessary 
constants used by the recordset.

The database contains a table called "Images" which has a field 
called "Image" which is of type "OLE Object" and this is where the GIF 
image is stored.

Any help would be very much appreciated.

----------------------- ASP code ---------------------

<!-- #INCLUDE FILE="inc_datastore.asp" -->
<%
Response.ContentType="image/GIF"
Dim rs, image
Set rs = Server.CreateObject ("ADODB.Recordset")
rs.Open "Images", strConnect, adOpenForwardOnly, adLockReadOnly, adCmdTable

image = rs("image")

rs.Close
Set rs = Nothing

Response.BinaryWrite image
%>

  Return to Index