473,320 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Displaying Img from Access using BinaryWrite

Hi,
Becoming quite frustrated with this.
I have a commercial database written in access and I'm trying to display
some images, jpegs, stored in the DB on web page.
My code is as follows:

Response.ContentType = "image/jpeg"

sql = "SELECT PartImage FROM Parts WHERE ShortID='AAPTM01'"
Set rs = AMConn.execute(sql)
If not rs.eof Then
PicSize = rs("PartImage").ActualSize
if PicSize > 0 then
Response.BinaryWrite
rs("PartImage").GetChunk(rs("PartImage").ActualSiz e)
end if
End If
set rs = nothing
All i get on the page is the image not found icon with the red cross in IE.
What could possibly be going on?

Any suggestions would be appreciated.
Jul 19 '05 #1
4 2562
Rob
I think you'll find the following will work:-

<%
' 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 passed.
Response.ContentType = "image/jpeg"

sql = "SELECT PartImage FROM Parts WHERE ShortID='AAPTM01'"
Set rs = AMConn.execute(sql)
If not rs.eof Then
Response.BinaryWrite rs("Partimage")
set rs = nothing
Response.End
else
set rs = nothing
end if
%>
--
Rob Collyer
_______________________________
www.webforumz.com
Free webdesign and development help,
tips, and website critique.


"Nathan Henderson" <na*****@mtannancc.nsw.edu.au> wrote in message
news:OF**************@TK2MSFTNGP11.phx.gbl...
Hi,
Becoming quite frustrated with this.
I have a commercial database written in access and I'm trying to display
some images, jpegs, stored in the DB on web page.
My code is as follows:

Response.ContentType = "image/jpeg"

sql = "SELECT PartImage FROM Parts WHERE ShortID='AAPTM01'"
Set rs = AMConn.execute(sql)
If not rs.eof Then
PicSize = rs("PartImage").ActualSize
if PicSize > 0 then
Response.BinaryWrite
rs("PartImage").GetChunk(rs("PartImage").ActualSiz e)
end if
End If
set rs = nothing
All i get on the page is the image not found icon with the red cross in IE. What could possibly be going on?

Any suggestions would be appreciated.

Jul 19 '05 #3
Sorry, didn't work, same prob,

I can't even seem to get it working on a db i have set up myself.
I gather this is the way to insert them: right click on field> insert
object> create from file> select the jpeg. Seems pretty sraight forward but
i cannot for the life of me figure out whats wrong.

any other suggestions??
I really need to get this going.


"Rob" <we*******@webforumz.com> wrote in message
news:cd**********@titan.btinternet.com...
I think you'll find the following will work:-

<%
' 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 passed.
Response.ContentType = "image/jpeg"

sql = "SELECT PartImage FROM Parts WHERE ShortID='AAPTM01'"
Set rs = AMConn.execute(sql)
If not rs.eof Then
Response.BinaryWrite rs("Partimage")
set rs = nothing
Response.End
else
set rs = nothing
end if
%>
--
Rob Collyer
_______________________________
www.webforumz.com
Free webdesign and development help,
tips, and website critique.


"Nathan Henderson" <na*****@mtannancc.nsw.edu.au> wrote in message
news:OF**************@TK2MSFTNGP11.phx.gbl...
Hi,
Becoming quite frustrated with this.
I have a commercial database written in access and I'm trying to display
some images, jpegs, stored in the DB on web page.
My code is as follows:

Response.ContentType = "image/jpeg"

sql = "SELECT PartImage FROM Parts WHERE ShortID='AAPTM01'"
Set rs = AMConn.execute(sql)
If not rs.eof Then
PicSize = rs("PartImage").ActualSize
if PicSize > 0 then
Response.BinaryWrite
rs("PartImage").GetChunk(rs("PartImage").ActualSiz e)
end if
End If
set rs = nothing
All i get on the page is the image not found icon with the red cross in

IE.
What could possibly be going on?

Any suggestions would be appreciated.


Jul 19 '05 #4
This help you at all?
Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.Open datasourcename

' Create Recordset
Set Disp_img = Server.CreateObject("ADODB.Recordset")
Disp_img.Open "SELECT file_image_blob FROM table_name WHERE
F_ID =" & Request("F_ID"), DataConn, 2, 3

If Not Disp_img.EOF Then
Response.ContentType = "image/jpeg"
Response.BinaryWrite Disp_img("file_image_blob")
End If

Disp_img.Close
Set Disp_img = Nothing

DataConn.Close
Set DataConn = Nothing

Let me know.

- Bastard
On Sun, 18 Jul 2004 21:59:31 +1000, "Nathan Henderson"
<na*****@mtannancc.nsw.edu.au> wrote:
Sorry, didn't work, same prob,

I can't even seem to get it working on a db i have set up myself.
I gather this is the way to insert them: right click on field> insert
object> create from file> select the jpeg. Seems pretty sraight forward but
i cannot for the life of me figure out whats wrong.

any other suggestions??
I really need to get this going.


"Rob" <we*******@webforumz.com> wrote in message
news:cd**********@titan.btinternet.com...
I think you'll find the following will work:-

<%
' 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 passed.
Response.ContentType = "image/jpeg"

sql = "SELECT PartImage FROM Parts WHERE ShortID='AAPTM01'"
Set rs = AMConn.execute(sql)
If not rs.eof Then
Response.BinaryWrite rs("Partimage")
set rs = nothing
Response.End
else
set rs = nothing
end if
%>
--
Rob Collyer
_______________________________
www.webforumz.com
Free webdesign and development help,
tips, and website critique.


"Nathan Henderson" <na*****@mtannancc.nsw.edu.au> wrote in message
news:OF**************@TK2MSFTNGP11.phx.gbl...
> Hi,
> Becoming quite frustrated with this.
> I have a commercial database written in access and I'm trying to display
> some images, jpegs, stored in the DB on web page.
> My code is as follows:
>
> Response.ContentType = "image/jpeg"
>
> sql = "SELECT PartImage FROM Parts WHERE ShortID='AAPTM01'"
> Set rs = AMConn.execute(sql)
> If not rs.eof Then
> PicSize = rs("PartImage").ActualSize
> if PicSize > 0 then
> Response.BinaryWrite
> rs("PartImage").GetChunk(rs("PartImage").ActualSiz e)
> end if
> End If
> set rs = nothing
>
>
> All i get on the page is the image not found icon with the red cross in

IE.
> What could possibly be going on?
>
> Any suggestions would be appreciated.
>
>



Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Matt | last post by:
Hi I'm have difficulty displaying images that are stored in a MySQL database. I've tried using the odbc.net provider, the ByteFX provider and the MySQLDriverCS one but can't seem to get the...
1
by: Eric Keung | last post by:
Hi all, my case is I want to get an image from access database and I just know it's "OLE object" field type at access I also don't know how to insert it into access here is my code and it just...
7
by: Jim | last post by:
I am trying to display images that are stored in a database, and I am using a repeater control. What I still use the Response.BinaryWrite method with a binding expression, if so, what with the...
3
by: CLEAR-RCIC | last post by:
I have several images i want to display in an ASP.Net application. The images are being passed to me in binary format from another application. Is there a good way to write them directly to an...
3
by: CD | last post by:
An application is logging faxes sent in SQL2000 image column type. I have found code on the net but what it is doing is prompting to save to local which is fine for single page image. Not good...
5
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, The following code was suggested by one of the users in this newsgroup when a pdf file was requested by a user from an asp page. I used the similar code in my page and the very interesting...
1
by: rascalking | last post by:
Hello, So I've read many forums that explained how to get an image out of SQL Server database and display it. I used an alternate .aspx page to retrieve the image and write it back as binary...
2
by: Just Me | last post by:
Hi, Im playing with this concept at the moment and was hoping to design an image retreival system which would allow me to place images into the web page " Where I want them", but draw them from...
1
by: i.sobha | last post by:
Hi, I tried retreiving an image from an access data base and display it to the asp page . The code is shown below. But the same is not working. Can someone provide me with some valuable...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.