Board index » delphi » Referential Integrity - PLEASE HELP

Referential Integrity - PLEASE HELP

I've got various Master-Detail-Detail tables in an application and need to
modify the tables.
I'd like to do this programmatically, but can't find any way to check out
the referential integrity/dependant table constraints within the program.
I'm using Paradox as the database and Paradox 7 or Database Desktop both let
be examine/change the constraints OK but what properties are there that
expose them??

If anyone has any ideas I'd be most grateful.

In anticipation,

Dave Johnson


Re:Referential Integrity - PLEASE HELP

You will probably find some most useful examples installed together with
Delphi in
Borland\Delphi 3\Demos\Db\DBerrors\Dberrors.dpr
the table event:     orders.ondeleteerror

 procedure TDM.OrdersDeleteError(DataSet: TDataSet; E: EDatabaseError;
    var Action: TDataAction);
    if E is EDBEngineError then
      if (E as EDBEngineError).Errors[0].Errorcode = eDetailsExist then
       {can not delete due to referential integrities}
        if MessageDlg('Delete this order and related items?',
          [mbYes, mbNo], 0) = mrYes then
          {Delete related records in linked 'items' table}
           {which means deleting 'detail' table records before deleting }
            { 'master' table records}
          while Items.RecordCount > 0 do
          {Finally,delete this record}
          Action := daRetry;
        end else Abort;

Mariusz Jedrzejowski
  messages send to
where (*) = @

Other Threads