BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Exceptions with dbExpress seams harder then ever

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress)
View previous topic :: View next topic  
Author Message
Mário Reis
Guest





PostPosted: Fri Oct 20, 2006 2:44 am    Post subject: Exceptions with dbExpress seams harder then ever Reply with quote



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





PostPosted: Fri Oct 20, 2006 3:24 am    Post subject: Re: Exceptions with dbExpress seams harder then ever Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.