Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 14th, 2006, 02:40 PM
Authorized User
 
Join Date: Mar 2005
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to arimakidd
Default viewing images in asp from access

I am trying to display images that would have been uploaded to an access database using an access form. The data entry is done in access. asp is being used to peruse the database. Based on my research I should pull the images out on one page and then refer to this page using html embed syntax. However I am not sure how good this works cause the first page is not even displaying the image. Thus far this is the code for the page that is supposed to pull out the image:

Code:
Dim adoCon         'Holds the Database Connection Object
Dim serVisit   'Holds the recordset for the records in the database
Dim strSQL          'Holds the SQL query to query the database


countn = 0

Response.Expires = 0
Response.Buffer = TRUE
Response.Clear

'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("FirmDataEntries.mdb")

Set rs = adoCon.Execute("SELECT Photograph FROM Offtbl WHERE OfficerName='JAMES BROWN'")

Response.ContentType = "image/gif"
Response.BinaryWrite rs("Photograph")

rs.Close
Set rs = Nothing
adoCon.Close
Set adoCon = Nothing
Response.End
Now the funny thing is that when I load the page in the "status" bar it reads donwloading from page etc..... The name of the page. But when its finished all you see is the broken icon which represents that an images is supposed to be displayed but some error has happened so nothing displayed. Something like what you get when you have an incorrect path to the image in your html. Would appreciate some help on this. Also future recommendations on a more stable platform for viewing pictures from a db.

 
Old August 15th, 2006, 03:26 AM
Authorized User
 
Join Date: Mar 2006
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Raghunathan
Default

hi,

Possible reason for your problem would be .. since you are using MS-ACCESS Db, in Access Images are stored as OLE Objects, it would'nt be possible to retrieved.

maybe u can try changing the content type to the appropriate content type of the image stored in the DB and
you've to use like this

   Response.Binarywrite rs("Photograph").GetChunk()

hope this info would help u



Regards,
Raghu





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Viewing Large Images arimakidd BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 November 20th, 2006 03:27 PM
viewing MS Access report from VB 6.0 jthadathilm16 Pro VB Databases 1 May 4th, 2006 08:15 PM
Viewing Data Access Pages thru internet pans HTML Code Clinic 1 February 2nd, 2005 09:57 PM
retrieving images from Access DB into asp page programmer_scs Classic ASP Databases 1 November 30th, 2004 10:19 AM
Viewing Access snapshots dnaworks Classic ASP Databases 3 October 6th, 2004 09:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.