Solved

Retrieving blob (image) from database

Posted on 2000-03-15
3
198 Views
Last Modified: 2010-04-02
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.
0
Comment
Question by:Your_Momma
  • 2
3 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2622297
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

0
 

Author Comment

by:Your_Momma
ID: 2623649

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
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 50 total points
ID: 2633334
Hi. Do you have FishFact example of Borland, that makes
Link between TDBImage and TDBGrid ?
Method a bit different, that i prepose:
TDBImage and TDBGrid use same TDataSource object
(DataSource1) and during TDBGrid change line of table,
automatically TDBImage had been changed , too.
If no image in line, i prepose will be empty.
If you have't rthis example, i can send you it
(write you EMail).You can easy make same in your
project.
Alex

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question