Solved

About Database and Image

Posted on 2002-07-01
8
136 Views
Last Modified: 2011-09-20
hello!
I want to ask a question!
if a picture's style is .JPG,
how to load the picture to a OLE field of a table?
(I'm using Microsoft Access 2000)

thanks!!!
0
Comment
Question by:Aquadp
[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
  • 5
  • 3
8 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7123650
TBlobField(table1.fieldbyname('AFieldName')).Loadfromfile; // or loadfromstream
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7132638
hello?
0
 

Author Comment

by:Aquadp
ID: 7137070
OH!
But When i run my program,it's displaying the error dialog that it can't load the JPG image to the OLE field!

???
what happened?
how to do!
Help!
0
Industry Leaders: 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!

 
LVL 27

Expert Comment

by:kretzschmar
ID: 7137080
what for a control do you use for display?
0
 

Author Comment

by:Aquadp
ID: 7137308
the controls of displaying are Images or DBImages.
when they were ready to load JPG images,system displayed the error dialog.

is the error belong to Delphi's Bug?
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7137349
hi,

jpg isn't supported by default,
therefore you can't use a tdbimage

but you can use a timage like

uses jpeg; //add jpeg into the uses clause

var
  j : TJpegImage;
  m : TMemoryStream;
begin
  j := TJpegImage.Create;
  m := TMemoryStream.Create;
  try
    if not dataset.fieldbyname('FieldName').IsNull then //only if available
    begin
      TBlobField(dataset.fieldbyname('FieldName')),SaveToStream(m);
      m.position := 0;
      j.loadfromstream(m);
      image1.picture.bitmap.assign(j);
    end;
  finally
    j.free;
    m.free;
  end;
end;

just from head,
use this code in the afterscroll-event of your dataset

meikl ;-)
 
0
 

Author Comment

by:Aquadp
ID: 7139383
THANKS A LOT!
Now i see.

Good luck 4 u~~~~
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 7139635
Good luck 4 u, too

don't forget the grade, if your question is now solved
(just press the the "accept comment" button upper right of the comment, which helped you most)

meikl ;-)
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses
Course of the Month6 days, 10 hours left to enroll

634 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