?
Solved

How to save picture to file without Tblobfield

Posted on 2004-08-06
1
Medium Priority
?
497 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
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
Course of the Month11 days, 3 hours left to enroll

770 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