war unterdessen selber draufgekommen
Delphi-Quellcode:
Procedure OpenDB;
var
i: integer;
tnodes : TTreeNodes;
node,Eintrag : TTreeNode;
begin
tnodes := frmmain.TreeView1.Items;
frmmain.ADOConnection1.GetTableNames(st,False);
frmmain.TreeView1.Items.Clear;
for i:=0 to st.Count - 1 do
begin
while frmmain.ADOQuery1.Active do
frmmain.ADOQuery1.Close;
frmmain.ADOQuery1.SQL.Text := 'select * from '+st.Strings[i];
frmmain.ADOQuery1.Open;
node := tnodes.Add(nil,st.Strings[i]+' ('+inttostr(frmmain.ADOQuery1.RecordCount)+')');
SetNodeBoldState(node, True);
node.ImageIndex:=0;
node.StateIndex:=0;
While Not frmmain.ADOQuery1.Eof do
begin
Eintrag:= tnodes.AddChild(node, frmmain.ADOQuery1.FieldByName('Feld1').AsString);
Eintrag.ImageIndex:=StrtoInt(frmmain.ADOQuery1.FieldValues['Feld3']);
Eintrag.StateIndex:=StrtoInt(frmmain.ADOQuery1.FieldValues['Feld3']);
frmmain.ADOQuery1.Next;
end;
end;
st.Free;
end;
Danke Trotzdem