Thema: Delphi Problem mit UNION Select

Einzelnen Beitrag anzeigen

mu8zeh

Registriert seit: 31. Mai 2007
36 Beiträge
 
#5

Re: Problem mit UNION Select

  Alt 6. Mai 2008, 15:45
Hallo

die Anzahl ändert sich je nach eingabe

Mal noch ein bsp. wie ich's jetzt habe. Bis zu 5 PERSNR geht's ganz flott.

//**********************************
//Datum wird bereit gestellt
//**********************************

With Form1.StringGrid1 do begin
For NZ:= 4 to ColCount do begin
Cells[NZ,4]:= '';
Cells[NZ,0]:= FormatDateTime('ddd',dDatum);
Cells[NZ,1]:= FormatDateTime('dd',dDatum);
Cells[NZ,2]:= FormatDateTime('m',dDatum);
Cells[NZ,3]:= FormatDateTime('YYYY',dDatum);
Cells[NZ,5]:= FormatDateTime('mm',dDatum);
dDatum := dDatum +1;
end;
end;

//************************************************** ***************
//Daten werden geladen
//************************************************** ***************
procedure TForm1.LadeDaten(Sender: TObject; d,m,X,Y,Z,S: Integer);
begin

Z := 0;
while StringGrid2.Cells[0,Z]<> '' do begin
inc(S);
inc(Z);
end;

Z := 0;
with StringGrid2 do
while StringGrid2.Cells[0,Z]<> '' do begin
mxStatusBar1.Panels[3].ProgressBar.Min := 0;
mxStatusBar1.Panels[3].ProgressBar.Max := S;
mxStatusBar1.Panels[3].ProgressBar.Position := Z;

with DataModule1.ZTEMP2007 do begin
SQL.Clear;
SQL.Add('SELECT TEMP2007.DATUM, TEMP2007.TAG, TEMP2007.MONAT, '+
'TEMP2007.JAHR, TEMP2007.PERSONALNR, TEMP2007.URLAUB, '+
'TEMP2007.KURZZEICHEN, TEMP2007.MEMOTEXT, TEMP2007.AENDERUNG, '+
'TEMP2007.AENDERUNGVON, KATEGORIE.COLOR FROM TEMP2007 '+
'INNER JOIN KATEGORIE ON (TEMP2007.KURZZEICHEN = '+
'KATEGORIE.KURZZEICHEN) WHERE TEMP2007.PERSONALNR = '+
QuotedStr(StringGrid2.Cells[0,Z]) +' AND TEMP2007.MONAT >= '+
QuotedStr(StringGrid1.Cells[4,5]) +' AND TEMP2007.JAHR = '+
QuotedStr(StringGrid1.Cells[4,3])+
' AND TEMP2007.KURZZEICHEN <> '+ QuotedStr('-')+' ORDER BY MONAT, TAG');
Active := True;
with StringGrid1 do begin
For X := 4 to StringGrid1.ColCount -1 do begin
Datum := StrToDate(Cells[X,1] + '.' + Cells[X,5] + '.' + Cells[X,3]);
First;
While Not Eof do begin
if FieldValues['DATUM'] = DateToStr(Datum) then begin
with StringGrid3 do
StringGrid3.Cells[x-4,Z] := FieldValues['KURZZEICHEN'];
end;
Next;
end;
end;
end;
Next;
end;
Z := Z+1;
end;
mxStatusBar1.Panels[3].ProgressBar.Position := 0;
end;
  Mit Zitat antworten Zitat