Re: Storing and displaying pictures with MS Access -D7
- From: "Andrew" <abaylis_nos@xxxxxxxxxxx>
- Date: Sun, 1 May 2005 09:14:10 +1000
"Jacques" <jacques.noah@xxxxxxxxxxxxxx> wrote in message
news:42739bc1@xxxxxxxxxxxxxxxxxxxxxxxxx
> Does anyone one know how to store and retrieve pictures(jpg,bmp etc) in a
> Access database? I tried to follow a tutorial on it at
> http://delphi.about.com but that example does not seem to work.
>
> Can anyone help?
> Thanks
Keith makes a valid point and for many images, we also use the same system
of just storing filenames in the database. If you only want to work with
smallish images, I suggest that you access the blob field using the
savetostream / loadfromstream methods. Use these to then load your visual
image component.
eg: TBlobField(MyDB.FieldByName('images')).SaveToStream(ms) //ms is a
temporary TMemoryStream
then load the image from ms:
ms.position:=0;
theimageobject.LoadFromStream(ms);
Alternatively, you can use TBlobStreams to load/save info into the blobfield
eg:
bs: TBlobStream;
bs:=MyDB.CreateBlobStream(MyDB.FieldByName('images'),bmRead);
theimageobject.LoadFromStream(bs);
Check out Delphi help for some of the caveats when using TBlobStreams
HTH
Andrew
.
- Next by Date: Re: trying to get a friendly error message from a SQL 2000 constraint
- Next by thread: Re: Storing and displaying pictures with MS Access -D7
- Index(es):
Relevant Pages
|