Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Datenbanken (https://www.delphipraxis.net/15-datenbanken/)
-   -   Delphi MySql Query = empty? (https://www.delphipraxis.net/135841-mysql-query-%3D-empty.html)

youuu 18. Jun 2009 18:12

Datenbank: MYSQL • Zugriff über: ODBC

MySql Query = empty?
 
Hi,

ich möchte eine While Schleife bauen, allerdings hab ich bislang nur eine endlos Schleife, Grund dafür ist, das ich nciht weiß wie ich abtesten kann ob das nächste Query leer ist?

Ich benutzte Zeos.

Query.Next zeigt mir das nächste Query an, bloß wie ist der Befehl für empty?

While Query <> nil do

endete in einer endlos Schleife.

haentschman 18. Jun 2009 18:18

Re: MySql Query = empty?
 
Hallo,

ganz einfach
Delphi-Quellcode:
if ZQuery.IsEmpty then // ist True bei leerer Datenmenge
:hi:

mkinzler 18. Jun 2009 18:24

Re: MySql Query = empty?
 
In diesem Fall wohl eher
Delphi-Quellcode:
While not Query.Eof do ...

youuu 18. Jun 2009 18:25

Re: MySql Query = empty?
 
Oh da hast du recht ist wirklich ganz einfach

haentschman 18. Jun 2009 18:34

Re: MySql Query = empty?
 
Zitat:

Zitat von mkinzler
In diesem Fall wohl eher
Delphi-Quellcode:
While not Query.Eof do ...

Prinzipiell ist das auch eine Lösung. Ich hatte mal einen Fall, da lieferte Eof nicht den richtigen Wert und die Schleife lief durch obwohl die Datenmenge leer war. (mit Zeos). IsEmpty dagegen funktioniert immer :wink:


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:40 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-2025 by Thomas Breitkreuz