I use C++BUILDER6+unidac3.5
try
{
、、、
UQRY->ApplyUpdates();
DM->UTT1->CommitRetaining();
}
catch(EIBCError &e)
{
ShowMessage("aaaaa");
}
program run and When an error,but Not implemented "ShowMessage("aaaaa");" why?
I want "335544665" this error.
try catch Did not catch the exception
UniDAC converts EIBCError to the EUniError exception. You can use the EUniError.InnerError property to get an inner exception like in the following code:
Code: Select all
try
{
UniQuery->ApplyUpdates();
}
catch(EUniError &e)
{
EIBCError *eribc = static_cast(e.InnerError);
ShowMessage(IntToStr(eribc->ErrorNumber));
}
The "335544665" error is a violation of the primary or unique keys. You can get this error from the ErrorNumber property of the EIBCError class. Here is an example:
Code: Select all
try
{
UniQuery->Append();
UniQuery->FieldByName("ID")->AsInteger = 1; // field "ID" is a primary key
UniQuery->Post();
UniQuery->Append();
UniQuery->FieldByName("ID")->AsInteger = 1;
UniQuery->Post();
UniQuery->ApplyUpdates();
}
catch(EUniError &e)
{
EIBCError *eribc = static_cast(e.InnerError);
ShowMessage(IntToStr(eribc->ErrorNumber)); // here you will see the message "335544665"
}