Why the exception is not caught?

85 Views Asked by At

Can somebody tell me why, in the code below, the exception is never caught? It always stops the program after attempting to execute the SQL command, throwing an Oracle server exception. I am using Devart UniDAC components in the Community Editon of C++Builder.

UniConn1->StartTransaction();
try
{
    Query1->Execute();
    UniConn1->Commit();
}
catch(Exception  *E)
{
    if (E->Message.Pos("ORA-0001" ) > 0)
        Application->MessageBox(L"Interrupção já cadastrada!",
                                    Application->Title.c_str(),
                                    MB_ICONERROR+MB_OK);
    else
        Application->MessageBox(E->Message.c_str(),
                                    Application->Title.c_str(),
                                    MB_ICONERROR+MB_OK);
    UniConn1->Rollback();
}
1

There are 1 best solutions below

1
Devart On

To handle exceptional situations in higher versions of RAD Studio using the method you provided, use the classic Borland compiler: Project Options\Building\C++ Compiler\C++ Compilers\Use 'classic' Borland compiler