Newbie - Delete problem
Posted: 14.03.2009, 06:36
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:
Now, with ZeosLib I have:
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
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;
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;
Am I missing something here?
Thank you