这个递归遍历错在哪?
zyhtz 2004-12-06 09:49:24 在窗口初始化中:SetTree(-1,0)
function SetTree(int ParentID,int Handle)//ParentID上级节点,Handle上级树节点
{
string sName
int ID,HandleID
DECLARE ORG CURSOR FOR
SELECT ORG_ID,ORG_NAME
FROM ORGANIZATION
WHERE ORG_PARENT_ID=:ParentID;
OPEN ORG;
FETCH ORG INTO :ID,:sName;
DO WHILE SQLCA.SQLCODE>=0
treeviewitem tvi_item
tvi_item.label=sName
tvi_item.data=ID
tvi_item.Children=true
tvi_item.pictureindex=1
tvi_item.selectedpictureindex=2
HandleID=tv_gov.insertitemlast(Handle,tvi_item)
SetTree(ID,HandleID)
FETCH ORG INTO :ID,:sName;
LOOP
CLOSE ORG;
}
看来看去没发现什么错误,但这个树就是出不来,大家看看错在哪