Solved

About Database and Image

Posted on 2002-07-01
8
130 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
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7137080
what for a control do you use for display?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now