Jayme Jeffman
Jayme Jeffman

Reputation: 53

Why the exception is not caught?

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();
}

Upvotes: 0

Views: 89

Answers (1)

Devart
Devart

Reputation: 122032

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

Upvotes: 1

Related Questions