Page 1 of 1

Newbie - Delete problem

Posted: 14.03.2009, 06:36
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

Posted: 20.03.2009, 23:51
by mdaems
What's the server exception you get?

Mark