当前位置: 代码迷 >> PB >> 将查询值放入plb中?解决办法
  详细解决方案

将查询值放入plb中?解决办法

热度:97   发布时间:2016-04-29 08:30:17.0
将查询值放入plb中??
plb_grant_menulist.reset()
ls_userid = trim(this.text)
select accfgsbm into :ls_companyid from st_user where userid =:ls_userid;//这边有值ls_companyid="102,101"
do while sqlca.sqlcode = 0
select companyname into :ls_companyname 
from company 
where companyid in (:ls_companyid);
plb_grant_menulist.additem(companyname,10000)
loop

//但是到了ls_companyname 却为空


------解决方案--------------------
函数:
integer split (string as_string, string as_separator, ref string as_array[]);

string ls,sep
long i,lpos,p,ln

sep = as_separator
ls = as_string + sep

i = 1
lpos = 1
ln = len(sep)

p = pos(ls,sep,lpos)
do while p > 0
as_array[i] = mid(ls,lpos,p - lpos)
lpos = p + ln
i++
p = pos(ls,sep,lpos)
loop

return i - 1

调用:
string ls_test,ls_res[]
long i

ls_test = '111,102,103,104,105'

split(ls_test, ',', ls_res[])

for i = 1 to upperbound(ls_res)
messagebox('',ls_res[i])
next
  相关解决方案