UniTable1.Delete;

Discussion of open issues, suggestions and bugs regarding LiteDAC (SQLite Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
vetalkw
Posts: 5
Joined: Fri 19 Mar 2021 09:52

UniTable1.Delete;

Post by vetalkw » Sat 04 Jun 2022 17:26

Good afternoon!
there is a code:

Code: Select all

procedure TFormP1.StringGrid2CellDblClick(const Column: TColumn;
  const Row: Integer);
begin
    UniTable2.RecNo:=1;
    UniTable2.Delete;
    ShowMessage('record '+IntToStr(UniTable2.RecNo)+' deleted');

end;
all rows in the table are deleted from me, how do I delete only record № 1?it seemed to me that if I put the carriage on the the first line (UniTable 2.RecNo:=1;) then the current row will be deleted, but now all rows are being deleted from my table.
how do I delete only line №1?

vetalkw
Posts: 5
Joined: Fri 19 Mar 2021 09:52

Re: UniTable1.Delete;

Post by vetalkw » Tue 07 Jun 2022 09:11

decision:

Code: Select all

procedure TFormP1.StringGrid2CellDblClick(const Column: TColumn;
  const Row: Integer);
begin
    UniTable2.RecNo:=ns+1;//in another part of the code, I assign NC the line number that the user clicked on
    UniTable2.Edit;
    ShowMessage('record '+UniTable2.Fields[2].AsString+' deleted');
    UniTable2.Delete;
end;
you also need to make sure that your table has at least one column with the status "primary key".

Post Reply