Jump to content
tobenschain

delete record

Recommended Posts

I am unable to delete a record. I get 

 

'[FireDAC][Phys][FB]-312. Exact update affected [0] rows, while [1] was requested'.
 

This is my code using TFDTable

 

    BudSys_DB.Active := true;
    BudSys_DB.RecNo := recnum;
    BudSys_DB.Delete;
 

This gives the same error 

 

    if BudSys_DB.Locate('KEY', sysp^.key, []) then begin
      BudSys_DB.Delete;
      del_sys := true; end;
 

Edited by tobenschain

Share this post


Link to post
On 10/19/2022 at 10:50 AM, tobenschain said:

BudSys_DB.RecNo := recnum;

Really ! I don't think this use of recnum is serious. Why don't you use something like 
 

if FDConnection.ExecSQL('DELETE FROM mytable where Key=:K',[sysp^.key ])>0 then showmessage('record(s) deleted'); 

Even if I am not sure of this sysp^.key have the good value 😲 expect yes, but this should be tested by debug

Edited by Serge_G
  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×