Solved

Retrieving blob (image) from database

Posted on 2000-03-15
3
194 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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.

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now