I want to show data within a grid component. Most of the fields are strings or numbers and one field is an image - BLOB db field on SQLite.
I'm using the TLiteQuery component to select data from the SQLite-DB. Besides the SELECT statement I define the datatypes to show them in a grid using the DataTypeMapping property of TLiteQuery. Any used fields are working well besides BLOB fields. How do I have to map a BLOB field to show an image in a grid. Without mapping, the grid column only shows [BLOB].
I hope you can help me, thanks in advance.
BLOB in TLiteQuery
Re: BLOB in TLiteQuery
Hello,
The standard DBGrid doesn't support automatic displaying of images independently on used data access components. You should implement image displaying by yourself, for example, in the TDBGrid.OnDrawDataCell event:
Or use third-party grids, that allow automatically show data from Memo fields
The standard DBGrid doesn't support automatic displaying of images independently on used data access components. You should implement image displaying by yourself, for example, in the TDBGrid.OnDrawDataCell event:
Code: Select all
procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
var
Bmp: TBitmap;
begin
if Field.FieldName = 'Graphic' then
begin
try
Bmp:=TBitmap.Create;
Bmp.Assign(Field);
DBGrid1.Canvas.StretchDraw(Rect, Bmp);
finally
Bmp.Free;
end
end
else
DBGrid1.DefaultDrawDataCell(Rect, Field, State);
end;
Or use third-party grids, that allow automatically show data from Memo fields
Re: BLOB in TLiteQuery
Thanks Alex,
that's what I need, with your advice helped me a lot ... thanks ...
that's what I need, with your advice helped me a lot ... thanks ...
Re: BLOB in TLiteQuery
Hello,
Glad to see that the problem was solved. If you have any other questions, feel free to contact us.
Glad to see that the problem was solved. If you have any other questions, feel free to contact us.