gwly 2003-11-11 10:28:23
我做了一个DW在里面加了一个CHECKBOX的框,如果我选择中这个框,我就查询出相关的数据来,现在是,不管选择多条,只能查询出最近选择的那条的数据来,我想把他做成选择多条就查询出多条的记录来,
我不知道要怎么写那个代码?
...全文
61 21 打赏 收藏 转发到动态 举报
写回复
用AI写文章
21 条回复
切换为时间正序
请发表友善的回复…
发表回复
gwly 2003-11-12
  • 打赏
  • 举报
回复
搞定,多谢大家,
lmby 2003-11-11
  • 打赏
  • 举报
回复
有重复的?那就
string ls_code

if dwo.name = 'chk' then
for j = 1 to dw_taxrate.rowcount()
if data = '0' then continue
ls_code = this.object.taxtypecode[row]
if pos( ls_code, ls_result ) = 0 then ls_result += ls_code + ' '
next
gwly 2003-11-11
  • 打赏
  • 举报
回复
但是不能得到我需要的结果,
gwly 2003-11-11
  • 打赏
  • 举报
回复
我上面的那代码,不用循环都可以,
gwly 2003-11-11
  • 打赏
  • 举报
回复
lmby(鹿门布衣)

ls_result他得到的值是相同的很多个值
lmby 2003-11-11
  • 打赏
  • 举报
回复
long j
string ls_result = ''

if dwo.name = 'chk' then
for j = 1 to dw_taxrate.rowcount()
if data = '0' then continue
ls_result += this.object.taxtypecode[row] + ' '
next
ls_sqlnew = dw_taxrate.GetSQLSelect()
ls_where = "where substring(taxrate.taxcode,1,2) in" + ls_result
ls_sql = ls_sqlnew + ls_where
dw_taxrate.setsqlselect(ls_sql)
............
toutou 2003-11-11
  • 打赏
  • 举报
回复
你的错错在ls_where = "where substring(taxrate.taxcode,1,2) = '"+ls_taxtypecode+"'"
ls_where 每循环一次,值都是不同的,而不是累加的
toutou 2003-11-11
  • 打赏
  • 举报
回复
首先,你的dw中不能设参数,用getsqlselect函数得到dw的sql,利用循环检测你的选择,然后拼
gwly 2003-11-11
  • 打赏
  • 举报
回复
long i,ls_xz,ll_index
string ls_sqlnew,ls_taxtypecode,ls_where,ls_sql

if dwo.name = 'chk' then

if data = '1' then

for i= 1 to dw_taxtypecode.rowcount()

ls_taxtypecode = this.object.taxtypecode[row]
ls_sqlnew = dw_taxrate.GetSQLSelect()

ls_where = "where substring(taxrate.taxcode,1,2) = '"+ls_taxtypecode+"'"

ls_sql = ls_sqlnew + ls_where

// messagebox("",ls_sql)
dw_taxrate.setsqlselect(ls_sql)
dw_taxrate.retrieve()
dw_taxrate.setsqlselect(ls_sqlnew)

next

end if
end if

要怎么写这段代码
lmby 2003-11-11
  • 打赏
  • 举报
回复
你debug啊。

再说开始的方法简单明了,干吗不那么做!
gwly 2003-11-11
  • 打赏
  • 举报
回复
不会搞了,头都大了,
lmby 2003-11-11
  • 打赏
  • 举报
回复
null reference是么?你的行号混乱了
gwly 2003-11-11
  • 打赏
  • 举报
回复
ls_delcode = dw_taxrate.object.taxcode[ll_in]

不好意思,是这句报错,呵呵,
lmby 2003-11-11
  • 打赏
  • 举报
回复
开始的不可能不行

这里if ls_delcode = ls_taxcodedel then
你说的空是null对么?那么如果ls_delcode等于空值,条件为true。那么

if not isnull( ls_delcode ) and ls_delcode = ls_taxcodedel then
gwly 2003-11-11
  • 打赏
  • 举报
回复
是最后面的这个问题
可在删除的时候,如果ll_in还有值,ls_delcode等于空值就报错,我要怎么解决这个问题呢?
klbt 2003-11-11
  • 打赏
  • 举报
回复
没有看明白问题,不过你的:
ls_where = "where substring(taxrate.taxcode,1,2)
在where前面应该增加一个空格
gwly 2003-11-11
  • 打赏
  • 举报
回复
for ll_in = 1 to ll_pos
ls_delcode = dw_taxrate.object.taxcode[ll_in]
for i = 1 to dw_querytaxrate.rowcount()
ls_taxcodedel = dw_querytaxrate.object.taxcode[i]

if ls_delcode = ls_taxcodedel then
dw_taxrate.deleterow(ll_in)
end if
next
end if
应该是这样
gwly 2003-11-11
  • 打赏
  • 举报
回复
就是开始的方法不行了,我才这样做的,
ll_pos = dw_taxrate.rowcount()
for ll_in = 1 to ll_pos
如果ll_in还有值,ls_delcode等于空值就报错,我要怎么解决这个问题呢?
lmby 2003-11-11
  • 打赏
  • 举报
回复
没看明白。哪句包错? 1 to ll_pos 是对什么循环?报错是不是因为你要删除的那行不存在?

开始的方法不行么?那样就可以了啊。
gwly 2003-11-11
  • 打赏
  • 举报
回复
for ll_in = 1 to ll_pos
if ls_delcode = "" then
ls_delcode = dw_taxrate.object.taxcode[ll_in]
for i = 1 to dw_querytaxrate.rowcount()
ls_taxcodedel = dw_querytaxrate.object.taxcode[i]

if ls_delcode = ls_taxcodedel then
dw_taxrate.deleterow(ll_in)
end if
next
end if

可在删除的时候,如果ll_in还有值,ls_delcode等于空值就报错,我要怎么解决这个问题呢?
加载更多回复(1)

1,108

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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