sp; isfind:=True;
parentnode:=tv1.Items.Item[i];
Break;
end;
if isfind then
tv1.Items.addchildobject(parentnode,trim(depart),pointer(id))
else
begin
adoquery2.Close;
ADOQuery2.SQL.Clear;
sqlstr:=''select * from tdepart'';
ADOQuery2.SQL.Add(sqlstr);
ADOQuery2.Open;
ADOQuery2.First;
while not ADOQuery2.Eof do
begin
if adoquery2.FieldByName(''departid'').AsInteger = parentid then
begin
id1:= adoquery2.FieldByName(''departid'').AsInteger;
depart1:= adoquery2.FieldByName(''departname'').AsString;
parentid1:= adoquery2.FieldByName(''parentid'').AsInteger;
Break;
end;
ADOQuery2.Next;
end;
createtree