以下代码是想实现从库里取数,一个一个加到树型里.可是不知要怎么来判断,下级的所属上级是某一个.
int i,j
datastore d_stroe_1 //定义数据存储对象
d_stroe_1=create datastore
d_stroe_1.dataobject="d_treeview"
d_stroe_1.settransobject(sqlca)
d_stroe_1.retrieve()
i=d_stroe_1.rowcount()
long ll_lev1,ll_lev2
treeviewitem ltv_new,ltv_old
getitem(handle,ltv_old)
for j=1 to i
aa=d_stroe_1.getitemstring(j,"czybh")
bb=d_stroe_1.getitemstring(j,"czy")
cc=d_stroe_1.getitemstring(j,"czyjb")
ltv_new.data=trim(aa)
ltv_new.label=trim(bb)
ltv_new.pictureindex=1
ltv_new.selectedpictureindex=6
ltv_new.children=true
ltv_new.level=integer(trim(cc))
if left(aa,3)=left("czybh",3) then
if ltv_new.level=1 then
ll_lev1=tv_1.insertitemlast(0,aa,1)
else
ll_lev2=tv_1.insertitemlast(ll_lev1,aa,2)
end if
end if
next