Hallo zusammen,
ich machen eine Abfrage und lade die Daten in ein Listview. Leider dauert das ewig lange.
Wie kann ich das beschleunigen?
hier mein Code dazu:
Delphi-Quellcode:
procedure ShortV(Listview: TListView; Alle: Boolean);
var
LI: TListItem;
Query: TADOQuery;
begin
Query:=TADOQuery.Create(
nil);
Query.Connection:=DataModule_DBConnect.ADOConnection1;
with Query do
begin
Close;
if Alle = True
then SQL.Text:='
Select distinct(tbl_w_daten.fk_w_id), tbl_w_id.username, tbl_umgebung.env'
+'
from tbl_w_daten, tbl_umgebung, tbl_w_id where tbl_w_id.fk_env_id = tbl_umgebung.pk_env_id'
+'
and tbl_w_id.pk_w_id = tbl_w_daten.fk_w_id order by tbl_w_daten.fk_w_id desc'
else SQL.Text:='
Select distinct(tbl_w_daten.fk_w_id), tbl_w_id.username, tbl_umgebung.env'
+'
from tbl_w_daten, tbl_umgebung, tbl_w_id'
+'
where tbl_w_id.fk_env_id = tbl_umgebung.pk_env_id and tbl_w_id.pk_w_id = tbl_w_daten.fk_w_id'
+'
and tbl_w_id.edit_date > sysdate-10 order by tbl_w_daten.fk_w_id desc';
Open;
ListView.Items.BeginUpdate;
Listview.Items.Clear;
while not (EOF)
do
begin
LI := Listview.Items.Add;
LI.Caption := FormatFloat('
000000', FieldByName('
fk_w_id').AsInteger);
LI.SubItems.Add(FieldByName('
env').AsString);
LI.SubItems.Add(FieldByName('
username').AsString);
Next;
end;
ListView.Items.EndUpdate;
Close;
end;
Query.Free;
end;
MfG
schuetze09