Somar dados

Delphi

28/06/2003

Ola pessoal !!!!

Alguém sabe como somar dados de uma tabela???

Tipo assim no meu programa de cadastro há uma formulario e nele há um button ao clicar no buton e este deve me trazer o total de clientes homesns que tenho e ao clicar e em outro buton o mesmop deve trazer o total de clientes mulhres que tenho.

Agradeço a todos ...
[andy]


Andy

Andy

Curtidas 0

Respostas

Wallacest

Wallacest

28/06/2003

bem, imagino que tenha um campo chamado Sexo ou coisa parecida

Vc pode pediar para ele percorrer a tabela procurando
Tipo

Var Mulher, Homem : Integer
While not TCliente.eof Do
Begin
If TClienteSexo.AsString = ´M´ Then
Begin
Homem := Homem + 1;
End;
If TClienteSexo.AsString = ´F´ Then
Begin
Mulher := Mulher + 1;
End;
TCLiente.next
end;
ShowMessage (´´+Homem+´ Homens´#10´´+Mulher+´ Mulheres)´);
end;


Essa rotina é para BD PARADOX usando Componente TABLE, tb pode usar SQL, ai é outro caso, mais é facil tb.

Qualquer duvida
Acho que isso pode t ajudar


GOSTEI 0
Wallacest

Wallacest

28/06/2003

bem, imagino que tenha um campo chamado Sexo ou coisa parecida

Vc pode pediar para ele percorrer a tabela procurando
Tipo

Var Mulher, Homem : Integer
While not TCliente.eof Do
Begin
If TClienteSexo.AsString = ´M´ Then
Begin
Homem := Homem + 1;
End;
If TClienteSexo.AsString = ´F´ Then
Begin
Mulher := Mulher + 1;
End;
TCLiente.next
end;
ShowMessage (´´+Homem+´ Homens´#10´´+Mulher+´ Mulheres)´);
end;


Essa rotina é para BD PARADOX usando Componente TABLE, tb pode usar SQL, ai é outro caso, mais é facil tb.

Qualquer duvida
Acho que isso pode t ajudar


GOSTEI 0
POSTAR