Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

InterBase delete

Status
Not open for further replies.

DaZZleD

Programmer
Oct 21, 2003
886
US
when I try to execute a delete statement on an IB table I always get the following exception: EIBClientError "Update Failed".

the delete seems to work ok (the records are deleted) and using try except, all works allright in the compiled program. Still this is an error and I would like to know if there's any way to eliminate it. I use the following code when deleting:
Code:
     // if a transaction is in progress, then commit and start a new one
     if form1.IBTransaction1.InTransaction then
        form1.IBTransaction1.Commit;
     form1.IBTransaction1.StartTransaction;

     form1.IBUpdateSQL1.DeleteSQL.Clear;
     // no matter how simple the statement
     form1.IBUpdateSQL1.DeleteSQL.Add('delete from customers where year="' + intTostr(form1.workingYear) + '";');
     try form1.IBUpdateSQL1.Apply(ukDelete);
     // on exception i do nothing
     except end;

     form1.IBTransaction1.Commit;

PS: all delete queries work ok when tried in SQL Explorer...


any help is appreciated.
 
hi dazzled,

why dont't you just use a TIBquery to do the job?

ibq.SQL.Text:='delete from customers where year="' + intTostr(form1.workingYear) + '";');
ibq.Transaction.StarTransaction;
try
ibq.ExecSQL;
ibq.Transaction.Commit;
except
ibq.Transaction.Rollback;
end;

 
it works ok... pretty strange though..

thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top