VFP建立三级树目录
****建立三个数据表,KM1,KM2,KM3****VFP9.0完美运行
ThisForm.OleControl1.Nodes.Clear
THIS.LINESTYLE=1
THIS.STYLE=7
This.nodes.add(,1,'KM','会计科目')
Select Distinct 一级名称,一级编号 From d:\tree\km1 Into Cursor Temp1
Scan
ThisForm.OleControl1.Nodes.Add('KM',4,'YJKM'+Alltrim(一级名称),一级名称)
Select Distinct 二级名称,二级编号 From d:\tree\km2 Where km2.一级编号==Temp1.一级编号 Into CURSOR Temp2
Select Temp2
Scan
ThisForm.OleControl1.Nodes.Add('YJKM'+Alltrim(Temp1.一级名称) ,4,'EJKM'+Alltrim(二级名称),二级名称)
Select Distinct 三级名称,三级编号 From d:\tree\km3 Where km3.二级编号==Temp2.二级编号 Into CURSOR Temp3
Select Temp3
Scan
ThisForm.OleControl1.Nodes.Add('EJKM'+Alltrim(Temp2.二级名称) ,4,,三级名称)
EndScan
Use In Temp3
Select Temp2
EndScan
Use In Temp2
Select Temp1
EndScan
Use In Temp1