bsp; for i:=0 to tv1.Items.Count-1 do
if ADOQuery1.fieldbyname(''parentid'').Asinteger = integer(tv1.Items.item[i].Data) then
begin
parentnode:=tv1.Items.Item[i];
Break;
end;
tv1.Items.addchildobject(parentnode,trim(ADOQuery1.fieldbyname(''departname'').AsString),
pointer(ADOQuery1.fieldbyname(''id'').AsInteger)) ;
end;
ADOQuery1.Next;
end;
end;