Link to home
Create AccountLog in
Avatar of Your_Momma
Your_Momma

asked on

Retrieving blob (image) from database

Hi,

I'm sending a picture to a database and storing it in an image column
StoredProc1->Params->Items[2]->LoadFromFile(EditAttach->Text,ftBlob);

where EditAttach is the path for the picture.
This all seems to work. However I don't know how to get this information back.
I'd like to have the name of the file or a simple notification (I can set up some kind of icon) to tell the user that a picture exists. He could then double-click on it...
But for now I'm more worried about getting the info back.
Any help would be greatly appreciated.
Thanks.
Avatar of AlexVirochovsky
AlexVirochovsky

Try the easy way. Use TDBImage to handle your graphics in the DB.
If a Datasource is linked to your table quParam and a TDBImage is linked to the
field BData of your table, your DBImage always shows the actual image. To port
it to a "normal" TImage just type

MyImage.Picture.Assign(MyDBmage.Picture);
I hope, it helps. Alex

Avatar of Your_Momma

ASKER


Sorry to reject this but this is not quite what I was looking for. Here are some more details that I should have mentioned.
The image is stored in a particular column of a table on my database. Depending on the unique key selected there may or may not be an image.

Therefore (maybe I misunderstand this part) if I associate Table1->TableName to the table on my database, I don't see how I can specifiy the column in which the image is stored.
I would like to associate the datasource by calling a stored procedure that is on my DB.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of AlexVirochovsky
AlexVirochovsky

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer