Insert image into SQL Server image col for Access

  • Thread starter Thread starter john celery
  • Start date Start date
J

john celery

I've inserted images into an sql table (image col) to view
the image from an Access form

This inserts the image successfully but Access doesn't
display the picture:

textcopy.exe /S myDesktop /U sa /P pass /D salesPeople /T
tblImage /C personImage /W "WHERE ID = 001" /F
c:\pics\guy.jpg /I /Z

the Access error when double clicking the image container:
"a problem occurred while access data project was
communicating with the ole server or activex
control....restart the ole server...try again"

If I insert the image directly from my Access form, it
works like a charm.

What seems to be the problem ?
 
It sounds like you are using OLE Embedding when you insert the image in an Access Form. In this case the
image is stored in the private OLE format of the associated application (whatever that is on that client
machine, and assuming that there is a suitable application). This can be problematic for several reasons:
usually images are stored uncompressed, so for jpeg there can be an overhead of as much as 100 times the
original file size. Ensuring that the relevant application is available and correctly registered on each
client system can be a major headache. Also, often it is not easy to get the image back out of the database
- if the source images were jpeg, then to get a jpeg image file back out of the field will usually require
an additional lossy compression step (and metadata such as EXIF will be lost).

The textcopy.exe should store the raw binary data (i.e. you should see 'Long Binary Data' in the field
if you open the table in Access). This avoids the problems of OLE Embedding, but Access can't display
the images directly. You can either write code to extract the image to a temporary file, then load it
into an Access Image Control (although this relies on Office Graphics Filters, and there are some caveats
with this control), or use some additional library or component to store and display the image (for example,
our control which can bind directly to binary fields in Access).

Group: microsoft.public.access.tablesdbdesign
Subject: Re: Dbase of photographs; not possible to store Jpeg
Date: 30 Mar 2004 22:15:15 +0200
From: "Exponent" <[email protected]>

www: www.hotmail.com

--------------------------------------------------------------------------------



Supress Article
Supress Thread Sent Email DNews


--------------------------------------------------------------------------------
Plain Text:


Larry Linson and Stephen Lebans both have VBA samples that you can try - links to both sites are on our
links page.

You can search the MS Knowledge Base for WriteBlob and ReadBlob, which deal with loading and extracting
binary data using GetChunk and AppendChunk in VBA.

GetChunk and AppendChunk are, in fact, ADO methods, as well as DAO.

I believe that the article is of general interest, and hardly a 'shameless plug'. It illustrates with
hard figures how raw binary avoids the bloat problem so frequently mentioned here in statements like 'Access
is inefficient at storing images', and it only briefly mentions our product as one possible solution.


--
_______________________________________________________
http://www.ammara.com/
Image Handling Components, Samples, Solutions and Info
DBPix 2.0 - lossless jpeg rotation, EXIF, asynchronous
 
Back
Top