procedure tf_dwzd.treerefresh;
var node1,node2:ttreenode;
i,j:integer;
strnode1,strnode2:string;
begin
with tv1 do
begin
Items.Clear;
node1:=Items.Add (nil,'行政机构名称');
query1.Close;
query1.sql.Clear;
query1.sql.add('select * from xzdwzd order by dwbh');
query1.open;
query1.first;
for i:=0 to query1.RecordCount-1 do
begin
strnode1:=query1.fieldbyname('dwbh').asstring+' '+query1.fieldbyname('dwmc').asstring;
node2:=items.AddChild(node1,strnode1);
query2.Close;
query2.sql.Clear;
query2.sql.add('select dwbh,dwmc from xzdwzd1 where left(dwbh,4)='''+query1.fieldbyname('dwbh').asstring+''' order by dwbh');
query2.open;
if not query2.eof then
begin
query2.first;
for j:=0 to query2.RecordCount-1 do
begin
strnode2:=query2.fieldbyname('dwbh').asstring+' '+query2.fieldbyname('dwmc').asstring;
items.AddChild (node2,strnode2);
query2.next;
end;
end;
query1.next;
end;
end;
end;