Newbie - Delete problem

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
alquimista
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 09.03.2009, 21:36

Newbie - Delete problem

Post by alquimista »

Hi,

I'm new using ZeosLib... and re-learning Delphi; I'm taking it after 6 year; previously I was using dbExpress drivers. I have Delphi 7 connected to mySQL 5.

Using dbExpress, to delete a selected recrod on a dbgrid, I used to have:

Code: Select all

    DataSource.DataSet.Delete;

    if TClientDataSet( DataSource.DataSet ).ApplyUpdates(0) > 0 then
        TClientDataSet( DataSource.DataSet ).CancelUpdates;
Now, with ZeosLib I have:

Code: Select all

  try

    DataSource.DataSet.Delete;
    TZQuery( DataSource.DataSet ).ApplyUpdates;

    Except on e:Exception do
    begin
        MessageDlg(e.Message, mtError, [mbOK], 0);
        TZQuery( DataSource.DataSet ).CancelUpdates;
    end;
The problem is when the Delete line is executed, I get a server exception that is not trapped by the "try...except " block... The exception is normal in the example I ran, since a referential integrity error is raised. Yet that is why I applied the try...except, and its not working :(


Am I missing something here?

Thank you
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

What's the server exception you get?

Mark
Image
Post Reply