Autor Beitrag
Nomis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 72



BeitragVerfasst: Sa 09.11.02 11:55 
Hallo

Ich habe eine BDE Datenbank und möchte gerne zählen wieveile Einträge im Feld "Okay" eine 1 haben kann mir da jemand helfen ?

Danke schon mal
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Sa 09.11.02 12:37 
Hi
Du verwendest dazu eine TQuery mit folgendem SQL-Statement:
ausblenden Quelltext
1:
Select count(*) from DeineTabelle where Okay = 1					


Wenn du die Query mit Active := True bekommst du als Ergebnis einen Datensatz mit einem Feld und da steht deine gesuchte Zahl drin.

Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...
Nomis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 72



BeitragVerfasst: So 15.12.02 20:40 
Hab Probleme mir die zahl in einem Label anzeigen zu lassen
Alibi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458

Win2K SP3
Delphi 6 Ent
BeitragVerfasst: So 15.12.02 21:08 
Bitte was?
Nomis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 72



BeitragVerfasst: So 15.12.02 21:14 
Na ja ich möchte mir die Zahl, die er zählt (also die anzahl der Datensätze die in "Okay" eine 1 haben) in einem Label anzeigen lassen wie ist das möglich ??
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: So 15.12.02 21:33 
Hi,

probiere es doch mal so :
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
    with Query1 do begin                            
      SQL.Clear;                                                             
      SQL.Add('SELECT COUNT(*) FROM DeineTabelle WHERE Okay=1');                               
      Open;                                                                    
      Active := True;                                                       
      while not Eof do begin                                             
         Label1.Caption := Fields[0].AsString;                    
        next;                                                                   
      end;                                                                      
    end;


Ansonsten poste mal Deinen Code, wie Du es versuchst.
Nomis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 72



BeitragVerfasst: So 15.12.02 21:39 
Tausend dank Es Funktioniert mit deinem Code