Loading any data from a query into a grid

Hi,

I want to be able to dynamically load the results of any query into a grid. At design time I do not know what the columns are.

I am currently using live bindings which works fine until it comes across an image.

Thanks,

Ken

Hi, 


It should automatically detect images and then display them, as demonstrated in our LiveBindings samples. If you want to dynamically load, do you mean switch between different queries? You should be able to do that, the columns should automatically be filled in based on the new query information.

Kind Regards, 
Pieter

Hi Pieter,

Thanks, yes it does. Just realized that the fields I am having problems with contain PDF's.

Ken

Hi, 


What you can try is to return a different format for the PDF blob field in the OnFormatCellDataExpression. It could possible be that the pdf data is detected as mtObject, or mtUnknown:

procedure TForm1.TMSFMXGrid1FormatCellDataExpression(Sender: TObject;
  AColumnDescription: TCreateColumnDescription; AColumn: Integer;
  var AFormat: string);
begin
  if AColumnDescription.MemberType = mtObject {mtUnknown} then
  begin
    AFormat := 'Cells[%s]';
  end;
end;

If that does not work, you can try AFormat := 'ToString'; which will clear the field

Kind Regards, 
Pieter

Thanks Pieter