TTMSFNCDataGrid / TTMSFNCDataGridDatabaseAdapter - How to achieve "LoadAllDataAndDisconnect" ?

Hi!
Is there already a way to achieve the same result as with old LoadAllDataAndDisconnect ?

Hi,

Right now, there is no equivalent, we'll add a LoadAllData method to the database adapter. Then you can use the following code:

  TMSFNCDataGridDatabaseAdapter1.LoadAllData;
  TMSFNCDataGridDatabaseAdapter1.KeepData := True;
  TMSFNCDataGridDatabaseAdapter1.Active := False;

You can use the following workaround until LoadAllData is available:

procedure TForm1.LoadAllData;
var
  r, c: Integer;
begin
  TMSFNCDataGrid1.Root.ExportNotification(gesExportStart, -1);
  try
    for r := 0 to TMSFNCDataGrid1.RowCount - 1 do
    begin
      TMSFNCDataGrid1.Root.ExportNotification(gesExportNextRow, r);
      for c := 0 to TMSFNCDataGrid1.ColumnCount - 1 do
        TMSFNCDataGrid1.Cells[c, r] := TMSFNCDataGrid1.Cells[c, r];
    end;
  finally
    TMSFNCDataGrid1.Root.ExportNotification(gesExportDone, -1);
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  LoadAllData;
  TMSFNCDataGridDatabaseAdapter1.KeepData := True;
  TMSFNCDataGridDatabaseAdapter1.Active := False;
end;