#1 Re: mORMot 2 » dbgrid component not display data record » 2023-08-20 02:37:27

tbo wrote:
anzhi wrote:

i found the "hello" field value only display the first letter,  this is why?

Please tell us the Delphi and mORMot version you are using.

I test it with above code  using Lazarus2.2.6 and mormot2,but it do not work!

I also test it  with SqlQuery, SQLlite3Connection , it works, the code as follows

procedure TFmUser.LoadDataFromSQL;
begin
    SQLQuery1.Close;
    SQLQuery1.SQL.Clear;
    SQLQuery1.SQL.Text:= 'SELECT * from user';
    DBGrid1.Options := DBGrid1.Options + [dgDisplayMemoText];
    SQLQuery1.Open;

end; 

thanks

#2 Re: mORMot 2 » dbgrid component not display data record » 2023-08-19 16:52:49

thanks very much, i trying to test it as above code, but i found some question,
the database which i select is sqlite, the data record as follow:
------------------------------------
     |    Name    |    Desc   |
-------------------------------------
     |       1       |      hello  |

but the DBGrid display data as follow

------------------------------------
     |    Name    |    Desc   |
-------------------------------------
     |       1       |      h  |

i found the "hello" field value only display the first letter,  this is why?
thanks!

#3 Re: mORMot 2 » dbgrid component not display data record » 2023-08-15 01:21:20

thanks very much!

i try to test it with json data , it  work !

i try to test it by using TOrmTableToGrid, it also work !

procedure TFmUser.LoadDataFromGrid;
var
  fTable: TOrmTable;
  fGrid : TOrmTableToGrid;
  DGrid: TDrawGrid;
begin
  Model := CreateUserModel;
  DGrid := TDrawGrid.Create(Self);
  DGrid.Parent := Panel6;
  Client := TDBClient.Create(Model, nil, 'lh.db', TRestServerDB, false, '');
  Client.Server.Server.CreateMissingTables;
  fTable := Client.MultiFieldValues(TOrmUser, 'Name,Desc');
  fGrid := TOrmTableToGrid.Create(DGrid, fTable, nil); 

But it did not work with dbgrid which DataSource.Dataset has data records, i guess whether the Client.MultiFieldValues result has some show question

#4 mORMot 2 » dbgrid component not display data record » 2023-08-14 06:29:20

anzhi
Replies: 7

I am trying to use DBgrid to display Mormot query result, but DBgrid Component not show data records ,the code is as follows:

  fTable := Client.MultiFieldValues(TOrmUser, 'Name,Desc');
  DataSource := TDataSource.Create(Self);
  fDataSet := TOrmTableDataSet.Create(Self, fTable);
  DataSource.DataSet := fDataSet;
  DBGrid1.DataSource := DataSource;

the reason is why , how to fix?

Board footer

Powered by FluxBB