Re: Problem retrieving images from Access 2003 Binary Large Object



No. You've only fixed part of the problem. And if you store a good number
of images in Jet tables, you'll eventually discover a much, much larger
problem and why Access experts advise against doing so.

Good luck.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.


"Paul H" <PaulH@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7660DF1F-BA3F-4F58-86F6-59A49AC9111F@xxxxxxxxxxxxxxxx
> Changing the strings to byte arrays has fixed the problem.
>
> Thanks
>
> --
> Paul H.
>
>
> "bob" wrote:
>
>>
>>
>> ReadBlob/WriteBlob use string functions, which causes the doubling of
>> size. Eliminate the string functions
>> and you will avoid the conversion & extra storage and will be able to
>> work with the data directly in ASP
>> as you require.
>>
>> --
>> _______________________________________________________
>> http://www.ammara.com/
>> Image Handling Components, Samples, Solutions and Info
>> DBPix 2.0 - lossless jpeg rotation, EXIF, asynchronous
>>
>>
>>
>> =?Utf-8?B?UGF1bCBI?= <PaulH@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>> >I can write and read jpeg images to/from MS Access table BLOB fields
>> >using
>> >the ReadBlob and Write Blob functions recommended in
>> >http://support.microsoft.com/?kbid=210486, and the retrieved image can
>> >be
>> >displayed in an MS access form image field.
>> >
>> >If I connect to the Access database from an ASP page and read the BLOB
>> >field
>> >using ADO.NET functions the returned file is twice the size of the file
>> >returned when reading the BLOB field using MS Access, and it cannot be
>> >displayed.
>> >
>> >The code for reading the BLOB field is listed below and copied from
>> >http://support.microsoft.com/default.aspx?scid=kb;en-us;326502 .
>> >
>> >Can you suggest what may be causing this problem.
>> >
>> >
>> >
>> >Comparing the contents of the two jpeg files returned it appears that
>> >each
>> >byte in the original file is converted to two bytes when stored in the
>> >MS
>> >access table. If the data is read back using the MS access WriteBLOB
>> >function
>> >then each pair of bytes is correctly reconverted back to one byte with
>> >the
>> >original value.
>> >
>> >When the BLOB is read from the ASP page this does not happen. I tried
>> >removing the most signifant byte of each pair of bytes and creating a
>> >file of
>> >the original size but the picture could still not be displayed.
>> >
>> >Further examination of the file contents showed that the most of the
>> >least
>> >significant bytes of each pair contained the original value but
>> >occasionally
>> >they did not and there is a value in the most significant byte.
>> >
>> ><%@ Page Language="VB" Debug="true" ContentType="text/html"
>> >ResponseEncoding="iso-8859-1" %>
>> ><%@Import Namespace="System.Data" %>
>> ><%@Import Namespace="System.IO" %>
>> ><%
>> >Dim PictureCol As Integer = 0 ' the column # of the BLOB field
>> >
>> >Dim cn As New OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;Data
>> >Source=C:\Inetpub\wwwroot\PaulsWebASPNet\LakeDistrictFells2000.mdb")
>> >
>> >Dim cmd As New OleDbCommand("SELECT photo FROM tblPhoto WHERE
>> >PhotoNumber=2", cn)
>> >
>> >cn.Open()
>> >
>> >Dim dr As OleDbDataReader = cmd.ExecuteReader()
>> >dr.Read()
>> >
>> >Dim b(dr.GetBytes(PictureCol, 0, Nothing, 0, Integer.MaxValue) - 1) As
>> >Byte
>> > dr.GetBytes(PictureCol, 0, b, 0, b.Length)
>> > dr.Close()
>> > cn.Close()
>> >
>> >â?~***** start of temporary code ******
>> >Dim fs As New
>> >System.IO.FileStream("C:\Inetpub\wwwroot\paulsWebaspNet\test2.jpg",
>> >IO.FileMode.Create, IO.FileAccess.Write)
>> > fs.Write(b, 0, b.Length)
>> > fs.Close()
>> >â?~***** end of temporary code ******
>> >
>> >'Response.Expires = 0
>> >'Response.Buffer = TRUE
>> >'Response.Clear
>> >'Response.ContentType = "image/jpg"
>> >'Response.BinaryWrite(b)
>> >'Response.End
>> >
>> >%>
>> >
>> >--
>> >Paul H.
>>
>>


.



Relevant Pages

  • Advice on using DISqlite3
    ... I'm trying the Personal edition of DISqlite3 and there ... What is the simplest way to store a stream in a blob field? ... bind the rowid to the prepared UPDATE statement ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Advice on using DISqlite3
    ... What is the simplest way to store a stream in a blob field? ... bind the rowid to the prepared UPDATE statement ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Bild in DB speichern
    ... Auslesen mit ASP: ... <How To Display Images Stored in a BLOB Field> ...
    (microsoft.public.de.german.entwickler.dotnet.asp)
  • Re: BLOB in asp
    ... FileStream _fileStream = null; ... Conversation: BLOB in asp ... Read the data from the BLOB into a byte array. ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: OCIDefineObject error
    ... Are you sure it's a BLOB? ... I notice you're fetching the payload from a queue table; ... DBD::Oracle::db prepare failed: ERROR OCIDefineObject call needed but not ... > I'm trying to retreive a blob field from oracle database. ...
    (perl.dbi.users)