-9

I want to store and retrieve images from sql database in Delphi XE.

My code:

TBlobField(query.FieldByName('image')).SaveToStream(MStream);    
Image1.Picture.Graphic.LoadFromStream(MStream);
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
banita
  • 153
  • 1
  • 2
  • 12

1 Answers1

2

Don't forget to set the stream position to 0 between saving from the database and reading from the image.

Rafe Kettler
  • 75,757
  • 21
  • 156
  • 151
Birger
  • 4,343
  • 21
  • 35
  • 1
    You should have read the comments to the original question before answering. There's a point being made. – Ken White Mar 31 '11 at 15:53
  • 5
    There is no point to not answering. Its not a game about collecting points, its about helping out when you can. – Gregor Brandt Apr 01 '11 at 05:19
  • 1
    @Gregor: not signing which answer solved the problem, the site looses parts of its utility - and you help less people. Some times, the most voted was not the selected - because the OP solved the problem with that answer or just the most voted appeared AFTER the selecion of accepted answer. – Fabricio Araujo Apr 01 '11 at 17:57
  • Maybe none of the answers solved his problems? – Gregor Brandt Apr 01 '11 at 21:15
  • 1
    @Gregor: So the OP has posted 13 questions and received answers that solved his problem only once? Then why didn't the OP post follow-up questions about the same topic? It's a matter of taking advantage of people and not having the courtesy to work with the community. The point is that this site was set up to work a certain way, and if you're willing to use it you should be willing to support it as designed. – Ken White Apr 01 '11 at 21:50