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

x
?
Solved

About Database and Image

Posted on 2002-07-01
8
Medium Priority
?
138 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
  • 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
Technology Partners: 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 150 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

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
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

971 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