Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Load image from DBGrid into a DBImage

Status
Not open for further replies.

dmarnerou

Programmer
Jun 12, 2002
30
CY
Hi,

I have a DBGrid which gets information from an ADOTable. I want to select a row from the DBGrid and when I press the button Show Image I want the selected image to appear in the DBImage field. So basically i want the source code behind the Show Image button :) I am working with *.bmp images.

Thanks,
Demetra
 
As you navigate through a DBGrid, you are moving the cursor of the linked TDataSet. If you link the DBImage to the same DataSet (e.g. by using the same DataSource as the DBGrid), it will automatically synchronize.

At that point, it is just a matter of showing the DBImage or not (you might want to wait until the Show button to minimize the amount of data moved over the network).

Cheers
 
I tried to do this but it didnt work. any other idea?
 
What happend when you tried?

Did the image just not appear or did you get an exception?

Cheers
 
If you use
Code:
TBlobField(DBGrid.DataSource.DataSet.FieldByName('IMAGE')).SaveToFile(AFileName);
, do you get a valid BMP file?

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top