Fórum DBEdit1.Exit como Edit1.Exit #286912
04/07/2005
0
Olá a todos,
Já enfrentei esta situação antes e não estou conseguindo agora.
Na inclusão quando eu uso:
procedure TCadDesigner.Edit1Exit(Sender: TObject);
begin
if DMDados.Emps.Locate(´CampoX´,Edit1.Text, []) then
begin
se existe
mostra registro
senao
inclui registro
end;
End;
funciona muito bem.
mais quando eu uso:
procedure TCadDesigner.DBEdit1Exit(Sender: TObject);
begin
if DMDados.Emps.Locate(´CampoX´,DBEdit1.Text, []) then
begin
se existe
mostra registro
senao
inclui registro
end;
End;
me retorna ´key violation´
Como eu poderia usar DBEdit1 sem que me retorne ´key violation´.
Um abraço a todos
Naelson
Já enfrentei esta situação antes e não estou conseguindo agora.
Na inclusão quando eu uso:
procedure TCadDesigner.Edit1Exit(Sender: TObject);
begin
if DMDados.Emps.Locate(´CampoX´,Edit1.Text, []) then
begin
se existe
mostra registro
senao
inclui registro
end;
End;
funciona muito bem.
mais quando eu uso:
procedure TCadDesigner.DBEdit1Exit(Sender: TObject);
begin
if DMDados.Emps.Locate(´CampoX´,DBEdit1.Text, []) then
begin
se existe
mostra registro
senao
inclui registro
end;
End;
me retorna ´key violation´
Como eu poderia usar DBEdit1 sem que me retorne ´key violation´.
Um abraço a todos
Naelson
Naelson
Curtir tópico
+ 0
Responder
Posts
05/07/2005
Marcio.theis
pq no lugar do DBEdit1.Text vc não utiliza o campo da tabela ? tipo:
procedure TCadDesigner.DBEdit1Exit(Sender: TObject);
begin
if DMDados.Emps.Locate(´CampoX´,tableXCAMPO.Value, []) then
begin
se existe
mostra registro
senao
inclui registro
end;
End;
procedure TCadDesigner.DBEdit1Exit(Sender: TObject);
begin
if DMDados.Emps.Locate(´CampoX´,tableXCAMPO.Value, []) then
begin
se existe
mostra registro
senao
inclui registro
end;
End;
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)