Fórum Alguem pode me ajudar nesse loop #327598
17/08/2006
0
begin
while ADOQuerysemvalor.Eof do
begin
if ADOQuerysemvalorINSCRICAO.Value = ADOQuerycomvalorINSCRICAO.Value then
ADOQuerysemvalor.edit;
ADOQuerysemvalorVALOR.Value := ADOQuerycomvalorVALOR.Value;
ADOQuerysemvalor.Post;
end
end;
end.
Digital_man
Curtir tópico
+ 0Posts
17/08/2006
Digital_man
procedure TForm1.Button1Click(Sender: TObject);
begin
while not ADOQuerysemvalor.Eof do
begin
if ADOQuerysemvalorINSCRICAO.Value = ADOQuerycomvalorINSCRICAO.Value then
ADOQuerysemvalor.edit;
ADOQuerysemvalorVALOR.Value := ADOQuerycomvalorVALOR.Value;
ADOQuerysemvalor.Post;
end
end;
end.
Ele s faz o primeiro e fica tudo lento gostaria que el fosse ate o final do banco.
Gostei + 0
17/08/2006
Cpd_arim
procedure TForm1.Button1Click(Sender: TObject);
begin
ADOQuerysemvalor.first;///////////////////inicio da tabela
while ADOQuerysemvalor.Eof do
begin
if ADOQuerysemvalorINSCRICAO.Value = ADOQuerycomvalorINSCRICAO.Value then /////esta tabela esta aberta???
ADOQuerysemvalor.edit;
ADOQuerysemvalorVALOR.Value := ADOQuerycomvalorVALOR.Value;
ADOQuerysemvalor.Post;
ADOQuerysemvalor.next;/////////// vai para o proximo campo
end
end;
end.
Gostei + 0
17/08/2006
Jonas_giron
begin
While Not ADOQuerysemvalor.Eof do begin
if ADOQuerysemvalorINSCRICAO.Value = ADOQuerycomvalorINSCRICAO.Value then
ADOQuerysemvalor.edit;
ADOQuerysemvalorVALOR.Value := ADOQuerycomvalorVALOR.Value;
ADOQuerysemvalor.Post;
ADOQuerysemvalor.Next;
end;
end.
usa o ´´ Whilie Not ´´
Gostei + 0
17/08/2006
Rjun
procedure TForm1.Button1Click(Sender: TObject); begin while not ADOQuerysemvalor.Eof do begin if ADOQuerysemvalorINSCRICAO.Value = ADOQuerycomvalorINSCRICAO.Value then begin // Estava faltando um begin ADOQuerysemvalor.edit; ADOQuerysemvalorVALOR.Value := ADOQuerycomvalorVALOR.Value; ADOQuerysemvalor.Post; end; ADOQuerysemvalor.Next; end end;
Gostei + 0
18/08/2006
Digital_man
procedure TForm1.Button1Click(Sender: TObject); begin while not ADOQuerysemvalor.Eof do begin if ADOQuerysemvalorINSCRICAO.Value = ADOQuerycomvalorINSCRICAO.Value then begin // Estava faltando um begin ADOQuerysemvalor.edit; ADOQuerysemvalorVALOR.Value := ADOQuerycomvalorVALOR.Value; ADOQuerysemvalor.Post; end; ADOQuerysemvalor.Next; end end;
Bom assim quando clico no botão ele faz o primeiro percorre toda a tabela, mais so faz o primeiro memso tendo certeza que os campos inscrições são iguais ele so faz o primeiro.???
Gostei + 0
18/08/2006
Rjun
Gostei + 0
18/08/2006
Digital_man
Quero que ele compare todos os registros da tabela, como vc falow.
Gostei + 0
18/08/2006
Rjun
[b:80848733ef]ADOQuerysemvalor => qyrSemValor[/b:80848733ef]
[b:80848733ef]ADOQuerycomvalor => qryComValor[/b:80848733ef]
procedure TForm1.Button1Click(Sender: TObject); begin qrySemValor.First; while (not qrySemValor.Eof) do begin qryComValor.First; while (not qryComValor.Eof) do begin if (qrySemValor.FieldByName(´Inscricao´).Value = qryComValor.FieldByName(´Inscricao´).Value) then begin qrySemValor.Edit; qrySemValor.FieldByName(´Valor´).Value := qryComValor.FieldByName(´Valor´).Value; qrySemValor.Post; end; qryComValor.Next; end; qrySemValor.Next; end; end;
Gostei + 0
23/08/2006
Digital_man
procedure TForm1.Button1Click(Sender: TObject); begin qrySemValor.First; while (not qrySemValor.Eof) do begin qryComValor.First; while (not qryComValor.Eof) do begin if (qrySemValor.FieldByName(´Inscricao´).Value = qryComValor.FieldByName(´Inscricao´).Value) then begin qrySemValor.Edit; qrySemValor.FieldByName(´Valor´).Value := qryComValor.FieldByName(´Valor´).Value; qrySemValor.Post; end; qryComValor.Next; end; qrySemValor.Next; end; end;
Po galera a ajuda de vcs foi massa, funcionou mais depois e que percebi que so vai funcionar se estiver na ordem, tipo ele verifica lado a lado, e no meu carro tem o seguinte a inscrição do primeiro campo pode estar no meio da outra tabela, no final, dai ele nunca acha pq ele compara lado a lado. teria que percorrer toda a tabela achar a inscrição igual e jogar no campo valor dela.
Gostei + 0
23/08/2006
Rjun
Gostei + 0
23/08/2006
Digital_man
Me desculpe amigo relamente vc tem razão, eu e que naum fiz direito agora consertei, obrigado pela força.
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)