Go to Post If all else fails, just ask the judges to turn off the gravity! :D - [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 29-09-2012, 11:31
miki miki is offline
Registered User
no team
 
Join Date: Sep 2012
Location: USA
Posts: 2
miki is an unknown quantity at this point
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;

Last edited by miki : 29-09-2012 at 11:33.
Reply With Quote
  #2   Spotlight this post!  
Unread 29-09-2012, 11:45
MrForbes's Avatar
MrForbes MrForbes is offline
Registered User
AKA: Jim
FRC #1726 (N.E.R.D.S.)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Sierra Vista AZ
Posts: 5,988
MrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond repute
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 29-09-2012, 11:47
IndySam's Avatar
IndySam IndySam is offline
Registered User
FRC #0829 (Digital Goats)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2004
Location: Indy
Posts: 3,355
IndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond reputeIndySam has a reputation beyond repute
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.
__________________
"Champions are champions not because they do anything extraordinary but because they do the ordinary things better than anyone else." —Chuck Knoll


2015 Indianapolis District Winner
2014 Boilermaker Regional Industrial Design Award
2013 Smoky Mountain Regional Industrial Design Award
2012 Boilermaker Engineering Excellence Award
2010 Boilermaker Rockwell Innovation in Control Award.
2009 Buckeye J&J Gracious Professionalism Award
2009 Boilermaker J&J Gracious Professionalism Award
2008 Boilermaker J&J Gracious Professionalism Award
2007 St Louis Regional Winners
Reply With Quote
  #4   Spotlight this post!  
Unread 29-09-2012, 11:50
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,071
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: PROBLEM with Retrieve image from MySql to Timage Using Delphi

Quote:
Originally Posted by miki View Post
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


Reply With Quote
  #5   Spotlight this post!  
Unread 29-09-2012, 12:47
miki miki is offline
Registered User
no team
 
Join Date: Sep 2012
Location: USA
Posts: 2
miki is an unknown quantity at this point
Re: PROBLEM with Retrieve image from MySql to Timage Using Delphi

Sorry, my mistake.

Thank you for your time. Best regards Miki.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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