Einzelnen Beitrag anzeigen

morri

Registriert seit: 6. Jun 2006
Ort: Wuppertal
106 Beiträge
 
Delphi 7 Professional
 
#1

Schleife / Ungültige Zeigeroperation!?

  Alt 28. Jun 2006, 11:26
Hallo zusammen.


Folgender Code:


Delphi-Quellcode:
FOR i:=1 TO 12 DO
   begin
    he2:=1;
    if i<9 then
     begin
      repeat
      zqapg.SQL.Text:='select * from liste INNER JOIN listeorte on reklamnr=liste where (`orte`='''+inttostr(he2)+''') AND (`reklamdatum`>='''+jahr+'-0'+inttostr(i)+'-01'') AND (`reklamdatum`<'''+jahr+'-0'+inttostr(i+1)+'-01'')';
      zqapg.Open;
      monat[i-1,he2]:=zqapg.RecordCount;
      he2:=he2+1;
      until he2=he;
     end;
    if i=9 then
     begin
      repeat
       zqapg.SQL.Text:='select * from liste INNER JOIN listeorte on reklamnr=liste where `orte`='''+inttostr(he2)+''' AND (`reklamdatum`>='''+jahr+'-0'+inttostr(i)+'-01'') AND (`reklamdatum`<'''+jahr+'-'+inttostr(i+1)+'-01'')';
       zqapg.Open;
       monat[i-1,he2]:=zqapg.RecordCount;
       he2:=he2+1;
      until he2=he;
     end;
    if (i=10) or (i=11) then
     begin
      repeat
       zqapg.SQL.Text:='select * from liste INNER JOIN listeorte on reklamnr=liste where `orte`='''+inttostr(he2)+''' AND (`reklamdatum`>='''+jahr+'-'+inttostr(i)+'-01'') AND (`reklamdatum`<'''+jahr+'-'+inttostr(i+1)+'-01'')';
       zqapg.Open;
       monat[i-1,he2]:=zqapg.RecordCount;
       he2:=he2+1;
      until he2=he;
     end;
    if i=12 then
     begin
      repeat
       zqapg.SQL.Text:='select * from liste INNER JOIN listeorte on reklamnr=liste where `orte`='''+inttostr(he2)+''' AND (`reklamdatum`>='''+jahr+'-'+inttostr(i)+'-01'') AND (`reklamdatum`<'''+jahrund1+'-01-01'')';
       zqapg.Open;
       monat[i-1,he2]:=zqapg.RecordCount;
       he2:=he2+1;
      until he2=he;
     end;
   end;
Er geht alles durch, aber wenn er die For-Schleife durch hat, und oben dann i=13 ist, kommt sofort die Meldung:
Ungültige Zeigeroperation.

Irgendwie blicke ich gerade da nicht durch, wo der Fehler ist.

Es ist sicherlich etwas umständlich programmiert, aber sollte iegentlich funktionieren.
hmm

Kann mir da jemand helfen?

Gruß,
Morri
  Mit Zitat antworten Zitat