Fórum Problema com ChangeCount do ClientDataSet #336019
11/01/2007
0
Estou enfrentando um problema ao excluir, estou excluíndo um registro do Client com Delete e testo antes do ApplyUpdates se ChangeCount é maior que zero. Mas estou excluíndo e o ChangeCount volta zerado.
O que será???
valeu.
Edvilson.chaves
Curtir tópico
+ 0Posts
11/01/2007
Truck1n
vc está usando assim ?
if (ClientDataSet1.ChangeCount > 0) then ClientDataSet1.ApplyUpdates(-1);
posta o código que você deleta o registro por favor!
Abraços!
Gostei + 0
11/01/2007
Edvilson.chaves
raise EBusinessError.Create(´Não existem registros a excluir.´);
if pPedirConfirmacao then
if Controle_Interface.Mensagem(´Confirma a exclusão do registro selecionado?´, mtInformation, [mbNo, mbYes]) <> mrYes then
Abort;
if GetClient.State = dsBrowse then
GetClient.Delete;
if GetClient.Active and (GetClient.ChangeCount > 0) then
begin
if pAbrirTransacao then
AbrirTransacao(FTDExcluir);
Try
// ExcluirOutrasTabelas; //???
if (GetClient.ApplyUpdates(pMaxErros) > pMaxErros) and (pMaxErros <> -1) then
begin
GetClient.CancelUpdates;
if (FMensagemReconcile = ´´) then
raise EAbort.Create(cMsgErroBDUpdate)
else
raise EAbort.Create(FMensagemReconcile);
end;
if pAbrirTransacao then
GetSQLConnection.Commit(FTDExcluir);
except
if pAbrirTransacao then
GetSQLConnection.Rollback(FTDExcluir);
raise;
end;
end;
Gostei + 0
11/01/2007
Edvilson.chaves
Obrigado a todos.
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)