数据窗口检索的问题??谢谢!

hwking 2002-11-01 09:07:46
数据窗口需要达到的目的是:
先是根据条件检索出符合条件的纪录,然后根据条件对某列进行排序,
最后是显示前面的100行数据,我是这样实现的:
//传递待排序的列名
if rb_1.checked=true then
col_name="sumqty"
elseif rb_2.checked=true then
col_name="saleamount"
elseif rb_3.checked=true then
col_name="subprice"
elseif rb_4.checked=true then
col_name="subrate"
end if

string ll_sort
if rb_5.checked=true then
ll_sort=" D"//降序排列
elseif rb_6.checked=true then
ll_sort=" A"//升序排列
end if

long count
select count(*)
into :count
from u_sale_top;
if count<=0 then
MessageBox("提示","查询前必须进行统计!",information!,ok!,1)
else
dw_2.settransobject(sqlca)
dw_2.retrieve()
dw_2.setsort(col_name+ll_sort)
dw_2.sort()
//去掉100以后的行
int i
if dw_2.rowcount()>100 then
for i=100 to dw_2.rowcount()
dw_2.deleterow(i)
next
end if
end if
结果不行----不符合要求!
请问错在哪儿?
...全文
25 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xwmhn 2002-11-01
  • 打赏
  • 举报
回复
对,楼上说得对,应该改为:
int i
if dw_2.rowcount()>100 then
for i=dw_2.rowcount() to 100 step -1 dw_2.deleterow(i)
next
end if
caic 2002-11-01
  • 打赏
  • 举报
回复
//去掉100以后的行
int i
if dw_2.rowcount()>100 then
for i=100 to dw_2.rowcount()
dw_2.deleterow(i)
next
end if

改成:

//去掉100以后的行
int i
if dw_2.rowcount()>100 then
for i=100 to dw_2.rowcount()
dw_2.deleterow(i)
i = i - 1//很重要!!!!
next
end if
jeking 2002-11-01
  • 打赏
  • 举报
回复
//去掉100以后的行
int i
if dw_2.rowcount()>100 then
for i=100 to dw_2.rowcount()
dw_2.deleterow(i)
next
end if

改成
//去掉100以后的行
int i
if dw_2.rowcount()>100 then
for i=dw_2.rowcount() to 100 step -1 dw_2.deleterow(i)
next
end if
hwking 2002-11-01
  • 打赏
  • 举报
回复
对——就是差一个地方:)
int i
if dw_2.rowcount()>100 then
for i=dw_2.rowcount() to 101 step -1 dw_2.deleterow(i)
next
end if

606

社区成员

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

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