AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Datenbanken Delphi Counting in a database table
Thema durchsuchen
Ansicht
Themen-Optionen

Counting in a database table

Ein Thema von danten · begonnen am 30. Nov 2012 · letzter Beitrag vom 30. Nov 2012
 
danten

Registriert seit: 19. Feb 2012
Ort: Czech Republic, Prag
126 Beiträge
 
Delphi 10.1 Berlin Architect
 
#8

AW: Counting in a database table

  Alt 30. Nov 2012, 11:31
first it might be better to use Integer-Fields thean String Fields, to avoid double counting.

second all Fields inthe Table should be defined and knowed, so you better use a Query like

Delphi-Quellcode:

        for I := Table.FieldDefs.Count -1 downto 2 do
        begin
          case Table.FieldByName(Table.FieldDefs[i].Name).AsInteger of
            1 : begin
                  cnt1:= cnt1 + 1;
                  Label1.Caption := IntToStr(cnt1) + ' x';
                  Application.ProcessMessages;
                end;
           10 : begin
                  cnt10 := cnt10 + 1;
                  Label2.Caption := IntToStr(cnt10) + ' x';
                  Application.ProcessMessages;
                end;
K-H
Thank you, now it counts quickly and correctly.
I somehow forgot the Case:
Daniel
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:13 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz