编程论坛's Archiver

yuxin1382 发表于 2007-10-10 08:56

treeview取数问题

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

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.