Solved

ADO+Access2000+Images how to...

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

778 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