Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

About Database and Image

Posted on 2002-07-01
8
Medium Priority
?
137 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 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

688 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