Announcement

Collapse
No announcement yet.

Bde + Query.IsEmpty + Interbase

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bde + Query.IsEmpty + Interbase

    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

  • #2
    Hallo Heiko,

    warum verwendest Du nicht gleich:
    <pre>
    with Query do
    begin
    Open;
    try
    while not EOF do
    begin
    // tuwas
    Next;
    end;
    finally
    Close;
    end;
    end;
    </pre>

    Gruß

    Torste

    Comment


    • #3
      Hallo Torsten,<p>
      ich hatte da mal was gelesen ...
      <br>
      also benutzt du das auch so ??
      <p>
      Heik

      Comment


      • #4
        Hallo Heiko,

        ja, aber ich arbeite mit den IBO-Komponenten. Mir sind mit den "BDE"-Komponenten keine Probleme bekannt (aber mein Gedächnis ist wie ein Sieb -> da bleibt nicht viel hängen ;o)))).

        Gruß

        Torste

        Comment


        • #5
          Hallo Torsten,<p>
          dann werde ich das mal anfangen, vorsichtig zu ändern.<p>
          Heik

          Comment

          Working...
          X