Delphi-Quellcode:
Query1.Sql.Clear;
query1.SQL.Add('select * from exceltabdatabase ');
start := true;
gl_kat := combobox2.ItemIndex;
if gl_kat <> -1 then
begin
start := false;
query1.sql.add(' where ');
if gl_kat = 1 then
query1.SQL.Add(' gl <= 5');
if gl_kat = 2 then
query1.SQL.Add(' gl between 6 and 10');
if gl_kat = 3 then
query1.SQL.Add(' gl between 11 and 15');
if gl_kat = 4 then
query1.SQL.Add(' gl > 15');
end;
if not((checkbox2.Checked = false) and (checkbox3.checked = false)) then
begin
if start = false then query1.SQL.Add('and') else
begin
query1.SQL.Add('where');
start := false;
end;
if checkbox2.Checked = true then
begin
query1.SQL.Add(' erfolg = 0');
end;
if checkbox3.Checked = true then
begin
query1.SQL.Add(' erfolg = 1');
end;
end;
if checkbox4.Checked = true then
begin
if start = false then query1.SQL.add(' and ') else
begin
query1.SQL.add(' where ');
start := false;
end;
query1.SQL.Add(' abrechnung_erfasst = 1');
end;
if checkbox1.Checked = true then
begin
if start = false then query1.SQL.add(' and ') else
begin
query1.SQL.add(' where ');
start := false;
end;
query1.SQL.Add(' nur_beratung = 1');
end;
memo1.Lines := query1.SQL;
memo1.Lines.Add(inttostr(combobox2.ItemIndex));
refresh(false);
so wirds gemacht - danke an alle die mir tipps gegeben haben!