Alguem pode me ajudar nesse loop
procedure TForm1.Button1Click(Sender: TObject);
begin
while ADOQuerysemvalor.Eof do
begin
if ADOQuerysemvalorINSCRICAO.Value = ADOQuerycomvalorINSCRICAO.Value then
ADOQuerysemvalor.edit;
ADOQuerysemvalorVALOR.Value := ADOQuerycomvalorVALOR.Value;
ADOQuerysemvalor.Post;
end
end;
end.
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
Curtidas 0
Respostas
Digital_man
17/08/2006
Gente naum achei onde alterar a mensagem que foi errada entaum coloquei aqui de novo ok.
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.
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
Cpd_arim
17/08/2006
não entendi muito bem o que vc quer fazer mas de uma olhada nos detalhes.
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.
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
Jonas_giron
17/08/2006
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;
ADOQuerysemvalor.Next;
end;
end.
usa o ´´ Whilie Not ´´
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
Rjun
17/08/2006
Só para dar uma organizada no código:
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
Digital_man
17/08/2006
Só para dar uma organizada no código:
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
Rjun
17/08/2006
Veja que esse loop age somente sobre uma tabela. Não sei bem o que você esta querendo fazer. Se for para comparar cada registro de uma tabela com cada registro de outra tabela, então serão necessários dois loops.
GOSTEI 0
Digital_man
17/08/2006
Veja que esse loop age somente sobre uma tabela. Não sei bem o que você esta querendo fazer. Se for para comparar cada registro de uma tabela com cada registro de outra tabela, então serão necessários dois loops.
Quero que ele compare todos os registros da tabela, como vc falow.
GOSTEI 0
Rjun
17/08/2006
Eu não gosto muito da nomenclatura que você usa, por isso vou colocar o código da forma que uso e depois você faz a substituição.
[b:80848733ef]ADOQuerysemvalor => qyrSemValor[/b:80848733ef]
[b:80848733ef]ADOQuerycomvalor => qryComValor[/b:80848733ef]
[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
Digital_man
17/08/2006
Eu não gosto muito da nomenclatura que você usa, por isso vou colocar o código da forma que uso e depois você faz a substituição.
[b:662c8315ef]ADOQuerysemvalor => qyrSemValor[/b:662c8315ef]
[b:662c8315ef]ADOQuerycomvalor => qryComValor[/b:662c8315ef]
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
Rjun
17/08/2006
O código que te passei não faz a comparação ´lado a lado´ não. Ele pega o registro da primeira tabela e compara com toda a segunda tabela. Depois que acabou de fazer a comparação com toda a segunda tabela ele avança para o próximo registro da primeira tabela e faz toda a comparação novamente.
GOSTEI 0
Digital_man
17/08/2006
O código que te passei não faz a comparação ´lado a lado´ não. Ele pega o registro da primeira tabela e compara com toda a segunda tabela. Depois que acabou de fazer a comparação com toda a segunda tabela ele avança para o próximo registro da primeira tabela e faz toda a comparação novamente.
Me desculpe amigo relamente vc tem razão, eu e que naum fiz direito agora consertei, obrigado pela força.
GOSTEI 0