OK, hier der Code mit dem ich das Listview befülle:
Delphi-Quellcode:
procedure AllUser(Listview: TListView);
var ADODataSet: TADODataSet;
ListItem : TlistItem;
begin
ADODataSet:= TADODataSet.Create(
nil);
ADODataSet.Connection:=DataModule_DBConnect.ADOConnection1;
Listview.Items.BeginUpdate;
try
ADODataSet.CommandText:='
SELECT * from tbl_username order by username';
ADODataSet.Open;
while not ADODataSet.EOF
do
begin
ListItem:=Listview.Items.Add;
ListItem.Caption:=ADODataSet.FieldByName('
username').AsString;
ListItem.SubItems.Add(ADODataSet.FieldByName('
admin').AsString);
ADODataSet.Next;
end;
except
on E:
Exception do
begin
MDialog(E.
Message, mtError, [mbOK]);
end;
end;
Listview.Items.EndUpdate;
ADODataSet.Close;
ADODataSet.Free;
end;