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

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

-save image

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’)).LoadFromStream(AStream);
ADODataSet1.Post;
end;
finally
AStream.Free;
end;

-Retrieve image

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

Hi, this is not a forum about the delphi programming language, it’s a robotics forum. Sorry.

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.

Try one of these forums:

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

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

Sorry, my mistake.

Thank you for your time. Best regards Miki.