Solved

ADO+Access2000+Images how to...

Posted on 2000-03-20
4
448 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
  • 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now