Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ADO+Access2000+Images how to...

Posted on 2000-03-20
4
Medium Priority
?
465 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 800 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month10 days, 20 hours left to enroll

885 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