| View previous topic :: View next topic |
| Author |
Message |
Mário Reis Guest
|
Posted: Fri Oct 20, 2006 2:44 am Post subject: Exceptions with dbExpress seams harder then ever |
|
|
Hi,
I used this peace of code now i don't now how to build a similar on for
DBExpress. Is there some one who want to help?
if (E is EDBEngineError) then
begin
with EDBEngineError(E) do
case Errors[0].ErrorCode of
DBIERR_KEYVIOL: ShowMessage('Chave já existe');
DBIERR_REQDERR: ShowMessage('Campo Obrigatório...') ;
DBIERR_MAXVALERR: ShowMessage('Valor Máximo Excedido...') ;
DBIERR_MINVALERR: ShowMessage('Valor Aquém do Mínimo...') ;
DBIERR_FORIEGNKEYERR: ShowMessage('Erro de Chave Externa.Como
Integridade Referencial.') ;
DBIERR_LOCKED: ShowMessage('Registo em Utilização...') ;
DBIERR_FILELOCKED: ShowMessage('Ficheiro Alocado...') ;
DBIERR_NETMULTIPLE: ShowMessage('Mais de um directório usado como
NetFileDir.') ;
DBIERR_LOOKUPTABLEERR: ShowMessage('Erro na Tabela de Pesquisa...')
;
end;
end
else
begin
ShowMessage('Erro ao escrever a Tabela:' +
#13#13 + E.Message);
Action := daAbort;
end;
Result := EDBEngineError(E).Errors[0].ErrorCode;
Thanks.
Mário |
|
| Back to top |
|
 |
Bill Todd Guest
|
Posted: Fri Oct 20, 2006 3:24 am Post subject: Re: Exceptions with dbExpress seams harder then ever |
|
|
The EDBEngineError exception is unique to the BDE so the code you
posted will not work with any other data access layer.
With dbExpress you need to create an TClientDataSet.OnReconcileError
event handler to handle errors that occur when you apply updates to the
database. To start, add the ReconcileError dialog from the Object
Repository to your project and follow the instructions in the comments
at the top of the unit file.
--
Bill Todd (TeamB) |
|
| Back to top |
|
 |
|