Problem: This is an example of how to retrieve an InterBase Blob in Delphi. Note: While this example was designed specifically for Interbase, it can easily be made to apply to any database. Solution: IB V4.x Delphi 3.0 There are several ways of retrieving InterBase Blob data within Delphi. This example uses the SaveToFile method. * Put TDatabase, TQuery, TDatasource and TDBGrid on the form. * set the Tdatabase's fields as follow: > Alias name to the BDE Alias. > DatabaseName to something you wish. > Connected to true * Set the TQuery fields as follow: > SQL to the sql statement to be executed, ie select * from table1 > DatabaseName to the same name you've named in the previouse step. * Set the TDatasource field DataSet to the name of the Tquery component. Default is query1. * Set the TDBGrid field DataSource to the name of the TDataSource component. Defualt is Datasource1. * Go back to TQuery component and double click. * Right click on the blank space on the windows said "form1.query". And choose add fields. * Select all the fields in the list and added. * Drop a TButton on the form. * Double click on the Tbutton. * Add the following lines between begin and end; procedure TForm1.Button1Click(Sender: TObject); begin query1image.savetofile('c:testimage.jpg'); end; Note: image is the field name defined as blob. And c:testimage.jpg is where the location of the image file to be created. * Save the project/form/unit. and Run. * Click on the Button will retrieve a blob entry and create file image.jpg.
Last Modified: 02-OCT-00