Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   General Forum (http://www.chiefdelphi.com/forums/forumdisplay.php?f=16)
-   -   PROBLEM with Retrieve image from MySql to Timage Using Delphi (http://www.chiefdelphi.com/forums/showthread.php?t=108793)

miki 29-09-2012 11:31

PROBLEM with Retrieve image from MySql to Timage Using Delphi
 
Hello,

I have problem to retrieve image from MySql database to Timage using delphi.

I can load image in to TImage (using TOpenPictureDialog). I can save Picture From Timage into MySql database. But I cant retrieve and show image into TImage.

sometimes I can retrieve image , but show only first image from database. I want to scroll DBGrid and see how pictures are changing.

I use this code for load, save and retrieve picture.

-Load image
Quote:

var
sDir : string;
begin
OpenPictureDialog1.Execute;
sDir := OpenPictureDialog1.FileName;
Image1.Picture.LoadFromFile(sDir);
end;
-save image
Quote:

var
AStream : TMemoryStream;AStream := TMemoryStream.Create;
try
Image1.Picture.Graphic.SaveToStream(AStream);
AStream.Position := 0;
if ADODataSet1.Active then
begin
ADODataSet1.Edit;
TBlobField(ADODataSet1.FieldByName('MyField')).Loa dFromStream(AStream);
ADODataSet1.Post;
end;
finally
AStream.Free;
end;
-Retrieve image
Quote:

var
AStream : TMemoryStream;
begin
AStream := TMemoryStream.Create;
try
if ADODataSet1.Active then
begin
TBlobField(ADODataSet1.FieldByName('MyField')).Sav eToStream(AStream);
AStream.Position := 0;
Image1.Picture.Graphic.LoadFromStream(AStream);
end;
finally
AStream.Free;
end;
end;

MrForbes 29-09-2012 11:45

Re: PROBLEM with Retrieve image from MySql to Timage Using Delphi
 
Hi, this is not a forum about the delphi programming language, it's a robotics forum. Sorry.

IndySam 29-09-2012 11:47

Re: PROBLEM with Retrieve image from MySql to Timage Using Delphi
 
Hi miki.

This is not a forum for Delphi software.
It is for a high school robotics competition called FIRST Robotics.
I doubt you get many helpful responses.

Good luck with your problem and if you would like to learn more about FIRST please explore more here and go to usfirst.org.

Ether 29-09-2012 11:50

Re: PROBLEM with Retrieve image from MySql to Timage Using Delphi
 
Quote:

Originally Posted by miki (Post 1188070)
I have problem to retrieve image from MySql database to Timage using delphi.

Try one of these forums:

http://www.tek-tips.com/viewthread.cfm?qid=1694533

http://forums.devshed.com/delphi-programming-90/

https://forums.embarcadero.com/index.jspa



miki 29-09-2012 12:47

Re: PROBLEM with Retrieve image from MySql to Timage Using Delphi
 
Sorry, my mistake.

Thank you for your time. Best regards Miki.


All times are GMT -5. The time now is 04:39.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi