Edit Record gives list index out of bounds

Discussion of open issues, suggestions and bugs regarding Virtual Data Access Components for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
tudi_x
Posts: 15
Joined: Thu 09 Jul 2015 17:14
Location: Oklahoma

Edit Record gives list index out of bounds

Post by tudi_x » Wed 20 Apr 2016 00:50

Hi Support,
I am having an exception when editing a record in a virtual table after adding a field in the virtual table.
Please advise how I can update the virtual table structure and also being able to edit the record.
The code is below. Using Lazarus with Unidac 6.2.10.

Code: Select all

 procedure TVirtualPop.DoRun;
  var
    Source: TVirtualTable;

  begin
    Source := TVirtualTable.Create(nil);
    Source.FieldDefs.Add('ID', ftInteger);
    Source.Open;
    Source.AppendRecord([1]);
    Source.Close;
    Source.FieldDefs.Add('A', ftString);  //works without this line
    Source.Open;
    writeln('NmbFields:' + IntToStr(Source.FieldCount));   //prints 2

    try
      with Source do
      begin
        if Locate('ID', 1, []) then
        begin
          Edit;
          FieldByName('ID').AsInteger := 100;
          Post;
        end;
      end;
    except
      on E: Exception do
      begin
        writeln('Error:' + E.Message);    //prints list index out of bounds
      end;
    end;
    Source.Free;
    Terminate;
  end;        
Thank you,

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Edit Record gives list index out of bounds

Post by AlexP » Wed 20 Apr 2016 05:35

Hello,

Please specify the versions of Lazarus and FPC

tudi_x
Posts: 15
Joined: Thu 09 Jul 2015 17:14
Location: Oklahoma

Re: Edit Record gives list index out of bounds

Post by tudi_x » Wed 20 Apr 2016 13:11

Lazarus 1.4.4.
FPC 2.6.4.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Edit Record gives list index out of bounds

Post by AlexP » Thu 21 Apr 2016 08:54

This issue is already fixed. The new version will be released within a week.

P.S. The new version will include support only for Lazarus 1.6.0 and FPC 3.0

tudi_x
Posts: 15
Joined: Thu 09 Jul 2015 17:14
Location: Oklahoma

Re: Edit Record gives list index out of bounds

Post by tudi_x » Mon 25 Apr 2016 16:04

Hi Support,
I installed version 6.3.11 on Lazarus 1.6 with FPC 3.0.
Confirming the code now works without exception.

Thank you!

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Edit Record gives list index out of bounds

Post by AlexP » Tue 26 Apr 2016 06:56

Glad to see that the issue was resolved. If you have any further questions, feel free to contact us.

Post Reply