注册 登录
编程论坛 PowerBuilder

[讨论]关于treeview的二级目录树的问题

junper 发布于 2007-06-22 20:30, 2144 次点击

关于treeview的二级目录树的问题


//定义变量
long ll_tempno1,ll_tempno2,ll_tvi
int i
string lxc
string tjp
//填充datawindow
connect using sqlca;
dw_1.settransobject(sqlca)
dw_1.retrieve()
disconnect using sqlca;
//填充TreeView
treeviewitem l_tvi
ll_tempno1=tv_1.insertitemfirst( 0, "系别", 1)
l_tvi.Expanded=true
connect using sqlca;
if(sqlca.sqldbcode<>0)then
messagebox("信息提示","数据库没有连接好!")
end if
declare cur1 cursor for
select distinct majoryno
from tong;
open cur1;
i=0
do while SQLCA.sqlcode = 0
fetch cur1 into :lxc;
l_tvi.label= lxc
l_tvi.data=1
ll_tempno2=tv_1.insertitemfirst(ll_tempno1, l_tvi)
i+=1
loop
tv_1.DeleteItem(i)
close cur1;
disconnect using sqlca;
我想在系别的下面再建一个二级的目录树是sno(学号) 也是在tong的表中获取 问一下该怎么改 注 majoryno为系别名

5 回复
#2
sam20802007-06-28 15:41

再用一个游标来取学号。。。嵌套在取系别的游标里面..

#3
junper2007-06-29 12:30

可是我不会嵌套啊 ,你能帮我一下吗

#4
路過2007-06-29 15:15

接上
string ls_sno
long ll_tempno3
treeviewitem l_tvi3

declare cur1 cursor for
select distinct majoryno
from tong;
open cur1;
fetch cur1 into :lxc;//t先插入兩判斷
do while SQLCA.sqlcode = 0
l_tvi.label= lxc
l_tvi.data=1
ll_tempno2=tv_1.insertitemfirst(ll_tempno1, l_tvi)

declare cur2 cursor for
select distinct sno
from tong
where ....;
open cur2;
fetch cur2 into :ls_sno;
do while SQLCA.sqlcode = 0
if isnull(ls_sno) then
ls_sno= ''
end if

ll_tempno3 = this.insertitemsort(ll_tempno2,ls_sno,1)
this.getitem(ll_tempno3,l_tvi3)
l_tvi3.data = ls_sno
l_tvi3.pictureindex = 1
l_tvi3.selectedpictureindex =2
this.setitem(ll_tempno3,l_tvi3)
fetch cur2 into :ls_no;//最後也要加上這個
loop
close cur2;

fetch cur1 into :lxc;
loop
close cur1;

二級的科目,也按三級的科目相應修改,我就不做相應改正。

#5
junper2007-07-02 22:42

谢谢斑竹了

#6
cheeseofzm2007-07-13 09:38

pb+sql
游标嵌套有错误

1