- Carla -
26/04/2005 - 10:37
Quando chega no Nome:=, ele dá q o valor é nulo. Provavelmente a cunsulta tem algum erro, mas qual?
while not (qryNiver.Eof) do
Begin
qryNiver.Active := False;
qryNiver.SQL.Clear;
qryNiver.SQL.Add('Select Niver, Nome, Cod from Dados where Cod like "%'+Label6.Caption + '%" and Niver like' + QuotedStr(FormatDateTime('dd/mm',now)));
qryNiver.Active := True;
Nome:= qryNiver.FieldByName('Nome').Value;
Label3.Caption:= 'Hoje é aniversário do(a) ' + Nome;
if qryNiver.RecordCount < 0 then
Label3.Caption:= 'Ninguém faz aniversário Hoje';
qryNiver.Next;
End;
| QUOTE |
| if qryNiver.RecordCount < 0 then |
Acho que essa condição nunca irá acontecer.
Deu certo, valeu!!
Mas como eu faço caso haja mais de um aniversariante no mesmo dia?
Progr'amador
26/04/2005 - 13:57
| QUOTE (Guest @ Apr 26 2005, 01:34 PM) |
Deu certo, valeu!! Mas como eu faço caso haja mais de um aniversariante no mesmo dia? |
Nesse caso vc pode usar um Memo ou um ListBox por exemplo:
usando Memo:
| QUOTE |
qryNiver.Close; qryNiver.SQL.Clear; qryNiver.SQL.Add('Select Niver, Nome, Cod from Dados where Cod like "%'+Label6.Caption + '%" and Niver like' + QuotedStr(FormatDateTime ('dd/mm',now))); qryNiver.Open; Memo1.Clear; if qryNiver.RecordCount > 0 then begin qryNiver.First; While not qryNiver.EOF do begin Memo1.Lines.Add(qryNiver.FieldByName('Nome').AsString); qryNiver.Next; end; end else Memo1.Text := 'Ninguém faz aniversário Hoje'; |
usando ListBox:
| QUOTE |
qryNiver.Close; qryNiver.SQL.Clear; qryNiver.SQL.Add('Select Niver, Nome, Cod from Dados where Cod like "%'+Label6.Caption + '%" and Niver like' + QuotedStr(FormatDateTime ('dd/mm',now))); qryNiver.Open; ListBox1.Clear; if qryNiver.RecordCount > 0 then begin qryNiver.First; While not qryNiver.EOF do begin ListBox1.Items.Add(qryNiver.FieldByName('Nome').AsString); qryNiver.Next; end; end else ListBox1.Items.Add('Ninguém faz aniversário Hoje'); |
Abs. Progr'amador.