Hallo,<p>
ich benutze immer folgendes Kosntrukt für Select-Queries.
<br>
<pre>
with Query do
begin
Open;
try
if QueryIsNotEmpty(Query) do
begin
while not EOF do
begin
// tuwas
Next;
end;
end;
finally
Close;
end;
end;
{ True, wenn die Query kein Ergebnis enthält }
function QueryIsEmpty(theQuery: TQuery): Boolean;
begin
{$IFDEF D1D2} { delphi1 delphi2 }
Result:= theQuery.RecordCount=0;
{$ELSE}
Result:= theQuery.IsEmpty;
{$ENDIF}
end;
{ True, wenn die Query Ergebnis enthält }
function QueryIsNotEmpty(theQuery: TQuery): Boolean;
begin
Result:= not QueryIsEmpty(theQuery);
end;
</pre>
Das Problem ist Result:= theQuery.RecordCount=0;<br>
Das Programm läuft noch unter Delphi2 (jaja ).
<p>
Mein Frage: Muß ich das QueryIsNotEmpty überhaupt benutzen. Ich habe vor, mal auf IBX oder ibobjects umzusteigen und aknn mich entsinnen, das ibx ein paar bugs mit Queries + RecordCount hatte.<br>
Ich weiß, RecordCount benutzt man nicht, aber IsEmpty kennt Delphi2 noch nicht.
<p>
Danke im voraus und schönes Wochenende
<br>
Heiko
ich benutze immer folgendes Kosntrukt für Select-Queries.
<br>
<pre>
with Query do
begin
Open;
try
if QueryIsNotEmpty(Query) do
begin
while not EOF do
begin
// tuwas
Next;
end;
end;
finally
Close;
end;
end;
{ True, wenn die Query kein Ergebnis enthält }
function QueryIsEmpty(theQuery: TQuery): Boolean;
begin
{$IFDEF D1D2} { delphi1 delphi2 }
Result:= theQuery.RecordCount=0;
{$ELSE}
Result:= theQuery.IsEmpty;
{$ENDIF}
end;
{ True, wenn die Query Ergebnis enthält }
function QueryIsNotEmpty(theQuery: TQuery): Boolean;
begin
Result:= not QueryIsEmpty(theQuery);
end;
</pre>
Das Problem ist Result:= theQuery.RecordCount=0;<br>
Das Programm läuft noch unter Delphi2 (jaja ).
<p>
Mein Frage: Muß ich das QueryIsNotEmpty überhaupt benutzen. Ich habe vor, mal auf IBX oder ibobjects umzusteigen und aknn mich entsinnen, das ibx ein paar bugs mit Queries + RecordCount hatte.<br>
Ich weiß, RecordCount benutzt man nicht, aber IsEmpty kennt Delphi2 noch nicht.
<p>
Danke im voraus und schönes Wochenende
<br>
Heiko
Comment