Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to save picture to file without Tblobfield

Posted on 2004-08-06
1
Medium Priority
?
509 Views
Last Modified: 2010-04-05
now i'm using TBlobField(AdoQuery2.fieldbyname('picture')).SaveToFile('Temp.jpg');
it works with dbgrid
but i need to save jpg picture without db grid..

This not work:

AdoQuery2.SQL.Clear; AdoQuery2.SQL.Add('Select picture from klientai where id = '+ id +'');
AdoQuery2.Open;
if not Adoquery2.IsEmpty then  //is there a picture?
    begin
      AdoQuery2.SaveToFile('Temp.jpg');
      Image1.Picture.LoadFromFile('Temp.jpg');
    end
  else
    begin
      Image1.Picture.Bitmap.Assign(Nil);  //there is no Image
    end;
0
Comment
Question by:selas
[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
1 Comment
 
LVL 17

Accepted Solution

by:
geobul earned 2000 total points
ID: 11736355
Hi,

AdoQuery2.SQL.Clear; AdoQuery2.SQL.Add('Select picture from klientai where id = '+ id +'');
AdoQuery2.Open;
if not Adoquery2.IsEmpty then  //is there a picture?
    begin
      TBlobField(AdoQuery2.fieldbyname('picture')).SaveToFile('Temp.jpg'); // <-- changed !!! You don't need dbgrid for doing this
      Image1.Picture.LoadFromFile('Temp.jpg');
    end
  else
    begin
      Image1.Picture.Bitmap.Assign(Nil);  //there is no Image
    end;

BTW 'id' field should be of integer type and 'id' variable should be String if you want to get any record from the database.

Regards, Geo
0

Featured Post

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!

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

636 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