Totte Karlsson
Totte Karlsson

Reputation: 1341

How to catch a TDBXException when using DBExpress

Using a TClientDataSet and a connection to a remote MySQL server, using DBExpress and C++ Builder XE3.

A TDBGrid shows data from a particular table, navigated with a TDBNavigator.

When deleting a record in the grid, the deletion is first only reflected/recorded in the TClientDataSet and not on the server. The server side attempt to delete the record occur when 'ApplyUpdates' is called, as happens when clicking the 'ApplyUpdates' button on the navigator.

If the row have foreign keys pointing to data, a TDBXException is thrown, and the row is not deleted on the server (as it should be).

Question is, where to catch this exception when using the TDBNavigator?

Trying to catch in the navigators OnClick event don't work:

    case TNavigateBtn::nbApplyUpdates:
        try
        {
            Log(lWarning) << "About to delete a row";
        }
        catch(...)
        {

        }
    break;

Any ideas?

Upvotes: 0

Views: 70

Answers (0)

Related Questions