大侠们,请指点一下啊!关于treeview的

xswei 2007-05-17 08:39:49
运行的时候一直出现 expression is not valid!
知道哪个地方出错了,请指点一下啊!!!

long rows , i , cur_len, p
string mycode,str,myname,mylabel
long handle_current,h1
treeviewitem item
treeviewitem newitem

//查找当前节点的句柄
h1=tv_1.finditem(currenttreeitem!,0)

//查找当前子节点的句柄
handle_current=tv_1.finditem(childtreeitem!,h1)

//当前节点没有子节点
if handle_current < 0 then
tv_1.getitem(h1,item)
mylabel=item.label//当前节点的文本mylabel
p=pos(mylabel,"--")
mycode=mid(mylabel,1,p - 1)//当前节点代码mycode
cur_len=len(mycode)//当前节点代码mycode的长度
//列出以mycode开头的记录,因为下级节点都是以mycode开头
str="id like'" + mycode + "%"
dw_1.setfilter( str )
dw_1.filter()
rows=dw_1.rowcount()

for i=1 to rows //插入下级节点
mycode=dw_1.getitemstring(i,"no")
myname=dw_1.getitemstring(i,"name")//从数据窗口读数据

if len(mycode)=cur_len + 2 then//下级节点的长度比父节点大2
newitem.label=mycode + "--"+ myname//新节点标题
newitem.pictureindex=(cur_len+2)/2+1//新节点图片
newitem.selectedpictureindex=(cur_len+2)/2+ 2
tv_1.insertitemlast(h1,newitem)//加入新节点
end if
next
end if
tv_1.expanditem(h1)
return 0
...全文
219 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
yuanqi007 2007-05-18
  • 打赏
  • 举报
回复
str="id like'" + mycode + "%"
修改为
str="id like '" + mycode + "%'"

752

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧