我用这个方法也成功了 with ADOQuery1 do begin Close; SQL.Text := 'select * from hr_orgaizeation order by F_NodeCode '; Open; First; while not Eof do begin case Length(Fieldbyname('F_NodeCode').AsString) of 4 : begin ANode := treeview1.Items.Add(nil,Fieldbyname('F_Name').AsString); end; 8 : begin BNode := treeview1.Items.AddChild(Anode,Fieldbyname('F_Name').AsString); end; 12 : begin CNode := treeview1.Items.AddChild(Bnode,Fieldbyname('F_Name').AsString); end; 16 : begin DNode := treeview1.Items.AddChild(Cnode,Fieldbyname('F_Name').AsString); end; 20 : begin ENode := treeview1.Items.AddChild(Dnode,Fieldbyname('F_Name').AsString); end; else end; Next; CodeSite.SendMsg(Fieldbyname('F_Nodecode').AsString); end; end;