Solved

How to save picture to file without Tblobfield

Posted on 2004-08-06
1
475 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
1 Comment
 
LVL 17

Accepted Solution

by:
geobul earned 500 total points
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

771 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

7 Experts available now in Live!

Get 1:1 Help Now