Solved

ADO+Access2000+Images how to...

Posted on 2000-03-20
4
456 Views
Last Modified: 2010-04-04
I am trying to display images (eg. bitmaps) stored in Access database, accessed from my Delphi Application using ADO.
1. I defined field in Access table as OLE Object and embedded bitmap in there.
2. I created ADO Table and put DBImage on it.
3. When I try to link to the image field in the table I get a message
'Bitmap Image is not valid'

I don't have much time to go through the books, therefore I offer 200 points.
I will need a step-by-step instructions.

Thanx.
0
Comment
Question by:graga
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 2639153
You can't use TDBImage when pictures are stored as OLE objects. Store pictures in a memo field instead.
0
 

Author Comment

by:graga
ID: 2639201
Epsylon,
I just created quickly data file with a single table, 2 fields, one memo.
I also have a very simple program that does the following:

ADOTable1.Append;
ADOTable1.FieldByName('Seq').AsInteger := 1;
ADOTable1.FieldByName('Picture').Assign(Image1.Picture);
ADOTable1.Post;

This does not work. I may need some more help please.
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 200 total points
ID: 2639215
Please ignore my previous comment. I'm mixing thing up.


You can only display bmp images with TDBImage. I used the following code to store a bmp image in an OLE object field:

var fs: TFileStream;
    bs: TBlobStream;
begin
  with ADOTable1 do
  begin
    Append;
    fs := TFileStream.Create('image1.bmp', fmOpenRead);
    bs := TBlobStream(CreateBlobStream(FieldByName('picture'), bmWrite));
    bs.CopyFrom(fs, 0);
    bs.Free;
    fs.Free;
    Post;
  end;
end;
0
 

Author Comment

by:graga
ID: 2639242
Epsylon,

You're a champion,

thanx
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question