Einzelnen Beitrag anzeigen

danten

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

Counting in a database table

  Alt 30. Nov 2012, 09:59
Datenbank: Absolute Database • Version: 7.1 • Zugriff über: Absolute Database
Hello.
I need advice on how to count multiple entries in a database table from the third column to the last column in the whole table.
I need to count how many times the table number 1 and 10.
I use this code and it is not good:
Delphi-Quellcode:
procedure Tfrm_main._NE;
var
  i,y: integer;
begin
  Application.ProcessMessages;
with Table do
  begin
    DisableControls;
    y := 0;
    try
      First;
    while not EOF do
    begin
    for I := Table.FieldDefs.Count -1 downto 2 do
    begin
    if Pos('1', Table.FieldByName(Table.FieldDefs[i].Name).AsString) > 0 then
    begin
      y := y + 1;
      Label1.Caption := IntToStr(y) + ' x';
      Application.ProcessMessages;
    end;
    if Pos('10', Table.FieldByName(Table.FieldDefs[i].Name).AsString) > 0 then
    begin
      y := y + 1;
      Label2.Caption := IntToStr(y) + ' x';
      Application.ProcessMessages;
    end;
    end;
     Next;
     Application.ProcessMessages;
    end;
    finally
      EnableControls;
      Application.ProcessMessages;
    end;
  end;
The result is always the same!
Daniel
  Mit Zitat antworten Zitat