Autor Beitrag
Josef-B
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 293

2003 Server, Win7, Win8
Delphi 2010 Pro, Firebird 2.5
BeitragVerfasst: Fr 11.02.05 23:37 
Ich habe eine while Schleife für Export von Daten

Ich möchte feststellen, ob ich beim letzten Satz stehe. Wenn in meiner Schleife eof=true ist, dann bin ich doch schon aus der Schleife raus.

Ich möchte bestimmte Aktionen auslösen, wenn er sozusagen auf den Letzten Satz kommt. Dann soll nämlich dieser letzte Satz mit einem bestimmten Zeichen gekennzeichnet werden.

Kann mir da jemand helfen?


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
with ibquery do
 begin
    while not eof do
    begin
    
    //Wenn ich nicht auf letztem Satz stehe dann mach irgendwas
    //wenn ich doch auf letztem Satz stehe, dann mache was anderes

    next;
  end;  
end;
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Fr 11.02.05 23:43 
Dann mach Deine Anweisungen, die Du beim letzten Datensatz ausführen lassen willst, doch nach der Schleife, denn da bist Du doch am letzten Datensatz angekommen?
Josef-B Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 293

2003 Server, Win7, Win8
Delphi 2010 Pro, Firebird 2.5
BeitragVerfasst: Fr 11.02.05 23:50 
Ich möchte die Anweisungen machen bevor der letzte Satz kommt :x

Es soll vor dem letzten Satz was beim Export eingefügt werden.

Moderiert von user profile iconUGrohne: Postings zusammengefasst
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Sa 12.02.05 08:53 
Du kannst RecordCount und und RecNo deines IBQuery verwenden.
Josef-B Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 293

2003 Server, Win7, Win8
Delphi 2010 Pro, Firebird 2.5
BeitragVerfasst: Sa 12.02.05 12:50 
Hallo Jasocul,

danke ja, das geht, hatte das mit dem recordcount auch schon vorher mal probiert. Das Ergebnis von recordcount hängt aber auch davon ab, wo der Satzzeiger steht, oder?

Muss dann heißen:

ausblenden Delphi-Quelltext
1:
2:
ibquery1.last;
ibquery1.recordcunt;


oder?

Wenn ich auf dem ersten Satz stehe, kommt 1 heraus, beim letzten die richtige Anzahl, oder? Ich stand vorher immer auf dem ersten und hab ich gewundert, warum das Ergebnis immer 1 ist.

Auf jeden Fall gehts.
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Sa 12.02.05 14:18 
Wenn Du in einer Schleife durchgehst, würde ich Dir eher empfehlen die Funktion IBQuery1.FetchAll; zu nehmen, dann veränderst Du nicht den Datensatzzeiger.