Einzelnen Beitrag anzeigen

Svenkan

Registriert seit: 10. Feb 2007
Ort: Bersenbrück
547 Beiträge
 
Delphi 7 Enterprise
 
#6

Re: Mehrmaliges Benutzen von Query.Next nicht möglich?

  Alt 18. Mai 2007, 17:44
Hier mal mit Query1:

Delphi-Quellcode:
  AssignFile(Datei, (ExtractFilePath(ParamStr(0)) + '\heute.htm'));
  Rewrite(Datei); // Datei neu schreiben
  a:='<html>'+sLineBreak+'<head>'+sLineBreak+'<table border="0" width="100%" style="border-collapse: collapse" id="table3">'+sLineBreak+'<tr>'+sLineBreak+'<td>'+sLineBreak+'<FONT face=Arial COLOR=#000080 style="font-size: 8pt">'+sLineBreak+'Stand: '+str+'
» [url="morgen.htm"]
'+tag_tomorrow+', '+tomorrow+'[/url]</FONT></td>'+sLineBreak+'<td>'+sLineBreak+'<p align="right">'+sLineBreak+'<font style="font-size: 8pt" color="#000080" face="Arial">'+schule+'</font></td>'+sLineBreak+'</tr>'+sLineBreak+'</table>
'+sLineBreak+'<table border="0" width="100%" id="table1" style="border-collapse: collapse">'+sLineBreak+'<tr>'+sLineBreak+'<td><font color="#000080" style="font-size: 18pt">Vertretungsplan für:</font><font size="5">'+sLineBreak+'<font color="#FF0000">'+wochentag+', '+today+'</font></font>
'+sLineBreak+'<font color=#009933 face=Arial size=4>- ohne Gewähr! -</font></td>';
  WriteLn(Datei, a);
  b:=sLineBreak+'<td align="right">'+sLineBreak+'<font color=#000080 face=Arial size=2>Der Plan wird '+zeitraum+' aktualisiert</font><p align="right"></td>'+sLineBreak+'</tr>'+sLineBreak+'</table>
'+sLineBreak+'<table cellpadding=2 cellspacing=1 border=0 width="98%" bgcolor="#000000">'+sLineBreak+'<tr>'+sLineBreak+'<td width=9% bgcolor=#FFFFFF>'+sLineBreak+'<font color=#000080 face="Times New Roman" style="font-size: 11pt">Klasse</font></td>'+sLineBreak+'<td width=9% bgcolor=#FFFFFF>'+sLineBreak+'<font color=#000080 face="Times New Roman" style="font-size: 11pt">Stunde</font></td>'+sLineBreak+'<td width=9% bgcolor=#FFFFFF>'+sLineBreak+'<font color=#000080 face="Times New Roman" style="font-size: 11pt">Es fehlt</font></td>';
  WriteLn(Datei, b);
  c:=sLineBreak+'<td width=9% bgcolor=#FFFFFF>'+sLineBreak+'<font color=#000080 face="Times New Roman" style="font-size: 11pt">Es vertritt</font></td>'+sLineBreak+'<td width=9% bgcolor=#FFFFFF>'+sLineBreak+'<font color=#000080 face="Times New Roman" style="font-size: 11pt">Fach</font></td>'+sLineBreak+'<td width=9% bgcolor=#FFFFFF>'+sLineBreak+'<font color=#000080 face="Times New Roman" style="font-size: 11pt">Raum</font></td>'+sLineBreak+' <td width=37% bgcolor=#FFFFFF>'+sLineBreak+'<font color=#000080 face="Times New Roman" style="font-size: 11pt">Bemerkung ('+IntToStr(Query1.RecordCount)+' Einträge)</font></td>'+sLineBreak+'</tr>';
  WriteLn(Datei, c);

  for count := 0 to Pred(Query1.RecordCount) do begin
   if count mod 2 = 0 then begin
    tdcolor:=tdc1;
    fccolor:=fc1;
   end
   else begin
    fccolor:=fc2;
    tdcolor:=tdc2;
   end;

   hcode:='<tr bgcolor="'+tdcolor+'">'+sLineBreak+'<td width=9%><font color="'+fccolor+'" size=2 face=Arial> '+Query1.FieldByName('KLASSEN').AsString+'</font></td>'+sLineBreak+'<td width=9%><font color="'+fccolor+'" size=2 face=Arial> '+Query1.FieldByName('S').AsString+'.</font></td>'+sLineBreak+'<td width=9%><font color="'+fccolor+'" size=2 face=Arial> '+Query1.FieldByName('FUER').AsString+'</font></td>';
   WriteLn(Datei, hcode);
   hcode2:='<td width=9%><font color="'+fccolor+'" size=2 face=Arial> '+Query1.FieldByName('WER').AsString+'</font></td>'+sLineBreak+'<td width=9%><font color="'+fccolor+'" size=2 face=Arial> '+Query1.FieldByName('FACH').AsString+'</font></td>'+sLineBreak+'<td width=9%><font color="'+fccolor+'" size=2 face=Arial> '+Query1.FieldByName('RAUM').AsString+'</font></td>'+sLineBreak+'<td width=37% bgcolor="'+tdcolor+'"><font color="'+fccolor+'" size=2 face=Arial> '+Query1.FieldByName('BEMER_SCH').AsString+'</font></td>'+sLineBreak+'</tr>';
   WriteLn(Datei, hcode2);
   Query1.Next;
  end;
  if NOT (heute.Lines.text='') then begin
   d:=sLineBreak+'<tr>'+sLineBreak+'<td width="91%" bgcolor="#FFFFCE" colspan="7">'+sLineBreak+'<font face="Times New Roman" color=#000080 style="font-size: 11pt">Mitteilungen:';
   WriteLn(Datei, d);
    WriteLn(Datei, '<ul>');
    For I:=0 to heute.Lines.Count -1 do
    WriteLn(Datei, '[*]'+heute.Lines[i]+'');
    WriteLn(Datei, '[/list]');
   e:='</font></td>'+sLineBreak+'</tr>';
   WriteLn(Datei, e);
  end;
Sven Kannenberg
  Mit Zitat antworten Zitat