🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.database.win32
1 messages
1 total messages Started by jose alsina Fri, 31 Aug 2007 11:04
Need help with catch updates
#106
Author: jose alsina
Date: Fri, 31 Aug 2007 11:04
42 lines
2177 bytes
Hi

I have an application where I use catch updates with local PARADOX tables. 
My problem is that I get 'List index out of bounds (3)'

The code shown below has one master table and several details tables. When I 
add a record to the master table and save the data it works fine but when I 
add a master and details (to one or more tables) I get the error. I have the 
master table as the first table on the list.

Another thing I have noticed is that the it appears to depend on the amount 
of memory I have. For example, it never happens when I run the application 
on a machine with 2GB of memory!

Any ideas?

procedure TDtmData.ApplyUpdates(const DataSets: array of TDBDataSet);
var
  i: Integer;
  Lst: TStringList;
  tbl: TTable;
begin
  Lst := TStringList.Create;
  try
    for i := 0 to High(DataSets) do
    begin
      tbl := TTable(DataSets[i]);
      Lst.AddObject(tbl.MasterFields, tbl.MasterSource);
      tbl.MasterSource := nil;
      tbl.MasterFields := '';
    end;
    AppManager.Database.ApplyUpdates(DataSets);
  finally
    for i := 0 to High(DataSets) do
    begin
      tbl := TTable(DataSets[i]);
      tbl.MasterSource := TDataSource(Lst.Objects[i]);
      tbl.MasterFields := Lst.Strings[i];
    end;
    Lst.Free;
  end;
end;
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads