Link to home
Start Free TrialLog in
Avatar of tanhnhi
tanhnhi

asked on

How to use Tdbimage?

Hello!
 I'm trying to use tdbimage to take bitmap images from a database file (Access). In that database file, I've got a table name 'Info' in which I have a field 'Image' which contains 'OLE Object' to store bitmap pictures. Then I use a TDBImage in my application to show the pictures in the database. But when I change the 'datafield' value of TDBImage to 'Image', I've got a error message 'Image bitmap incorrect'. How can I solve the problem? Thanks
Avatar of mocarts
mocarts

I think reason is simple - OLE Object is not the same as Image. You should use OLE Container (using its LoadFromStream method) to display your OLE object.

examp:
var
 s: TStream;
begin
 Query1.SQL.Text := "..."
 Query1.Open;
 s := Query1.CreateBlobStream(Query1.FieldByName('img'), bmRead);
 try
   OLE1.LoadFromStream(s);
 finally
   s.Free;  // must free stream
 end;
end;

I don't see the way to use TDBImage with Access datatypes :(

wbr, mo.
Use  Graphic type field in paradox.It works fine for me
venks
How you store these bitmaps in your table? by using access frontend? if so - I think, there will be incompatible formats. you can use Acccess OLE Object field as BLOB field in your Delphi app, but you can't get those objects in Delphi if you didn't saved them in your table with Delphi's SaveToStream.
mo.
tanhnhi:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
Hi!
No comment has been added lately and this question is therefore classified abandoned.

If asker wishes to close the question, then refer to
https://www.experts-exchange.com/help/closing.jsp

Otherwise, I will leave a recommendation in the Cleanup topic area that this question is:

PAQ'd and pts refunded

Please leave any comments here within the next seven days. It is assumed that any participant not responding to this request is no longer interested in its final disposition.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

...Snehanshu
EE Cleanup Volunteer

P.S.
  I have no clue of this one, so experts please suggest.
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial