treeviewitem ltvi_new
integer li_rows,li_cnt
long ll_level0,ll_level1,ll_level2,ll_level3
string ls_paycode0,ls_payname0
string ls_paycode1,ls_payname1
string ls_paycode2,ls_payname2
string ls_paycode3,ls_payname3
//显示数据
dw_base.settransobject(sqlca)
li_rows = dw_base.retrieve()
ls_paycode0 = '1300000000%'
//声明游标
DECLARE cur_list0 CURSOR FOR SELECT weituotable.payname,weituotable.paycode FROM weituotable WHERE (weituotable.paycode like:ls_paycode0) and (weituotable.paycode = '1300000000');
//打开游标
open cur_list0;
//将游标的值赋给变量
fetch cur_list0 into :ls_payname0,:ls_paycode0;
ltvi_new.data = ls_paycode0
ltvi_new.label = ls_payname0
ltvi_new.pictureindex = 2
ltvi_new.selectedpictureindex = 2
ltvi_new.children = true
//在根上插入“一级单位名称”
ll_level0 = tv_1.insertitemlast(ll_level0,ltvi_new)
//关闭游标
close cur_list0;
ls_paycode1 = '13___00000%'
//声明游标
DECLARE cur_list1 CURSOR FOR SELECT weituotable.payname,weituotable.paycode FROM weituotable WHERE (weituotable.paycode like:ls_paycode1) and (weituotable.paycode <> '1300000000');
//打开游标
open cur_list1;
//将游标的值赋给变量
fetch cur_list1 into :ls_payname1,:ls_paycode1;
ll_level1 = 1
DO WHILE sqlca.sqlcode = 0
ltvi_new.data = ls_paycode1
ltvi_new.label = ls_payname1
ltvi_new.pictureindex = 2
ltvi_new.selectedpictureindex = 2
ltvi_new.children = true
//插入委托收款单位名称
ll_level2 = tv_1.insertitemlast(ll_level1,ltvi_new)
ls_paycode2 = left(ls_paycode1,5)
//获得委托付款单位名称的编码
ls_paycode2 = ls_paycode2 + "_____"
//声明游标
DECLARE cur_list2 CURSOR FOR SELECT weituotable.payname,weituotable.paycode FROM weituotable WHERE weituotable.paycode LIKE :ls_paycode2 AND weituotable.paycode not like '13___00000';
//打开游标
open cur_list2;
//将游标的值赋给变量
fetch cur_list2 into :ls_payname2,:ls_paycode2;
DO WHILE sqlca.sqlcode = 0
ltvi_new.data = ls_paycode2
ltvi_new.label = ls_payname2
ltvi_new.pictureindex = 2
ltvi_new.selectedpictureindex = 2
ltvi_new.children = true
//在委托收款单位名称下插入付款单位名称
tv_1.insertitemlast(ll_level2,ltvi_new)
//将游标的值赋给变量
fetch cur_list2 into :ls_payname2,:ls_paycode2;
/*
////////////////////////////////////////////////////////////////////////////
ll_level3 = tv_1.insertitemlast(ll_level2,ltvi_new)
ls_paycode3 = '13_____000%'
ls_paycode3 = left(ls_paycode3,7)
//获得委托付款单位名称的编码
ls_paycode3 = ls_paycode3 + "___"
//声明游标
DECLARE cur_list3 CURSOR FOR SELECT weituotable.payname,weituotable.paycode FROM weituotable WHERE weituotable.paycode LIKE :ls_paycode3 AND weituotable.paycode not like '13_____000';
//打开游标
open cur_list3;
//将游标的值赋给变量
fetch cur_list3 into :ls_payname3,:ls_paycode3;
DO WHILE sqlca.sqlcode = 0
ltvi_new.data = ls_paycode3
ltvi_new.label = ls_payname3
ltvi_new.pictureindex = 2
ltvi_new.selectedpictureindex = 2
ltvi_new.children = false
//在委托收款单位名称下插入付款单位名称
tv_1.insertitemlast(ll_level3,ltvi_new)
//将游标的值赋给变量
fetch cur_list3 into :ls_payname3,:ls_paycode3;
LOOP
//关闭游标
close cur_list3;
///////////////////////////////////////////////////////////////////////////////
*/
// //将游标的值赋给变量
// fetch cur_list2 into :ls_payname2,:ls_paycode2;
LOOP
//关闭游标
close cur_list2;
fetch cur_list1 into :ls_payname1,:ls_paycode1;
LOOP
//关闭游标
close cur_list1;
------解决方案--------------------
你把第三级的游标整个注释掉了是什么意思?你的代码本身就是这么写的?