cursor 遍历问题

xdxycx 2004-03-01 11:07:33
我用CURSOR对一张表进行遍历如下
string str_bargaintype
declare type_cur cursor for
select bargaintypename from
bargaintype;
open type_cur;

DO WHILE sqlca.sqlcode = 0
FETCH type_cur INTO :str_bargaintype;
lb_1.additem(str_bargaintype)
LOOP

close type_cur;

为什么最后会多出一天数据呢
如我只有三条数据,但是在LISTBOX中却出现四条数据
...全文
66 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
amekoxiao 2004-08-06
在循环外加
FETCH type_cur INTO :str_bargaintype;

d
回复
liujw0211 2004-08-06
string str_bargaintype
declare type_cur cursor for
select bargaintypename from
bargaintype;
open type_cur;

FETCH type_cur INTO :str_bargaintype;
DO WHILE sqlca.sqlcode = 0

lb_1.additem(str_bargaintype)
FETCH type_cur INTO :str_bargaintype;
LOOP

close type_cur;
回复
鸡翅多 2004-08-06
判断一下,如果是空,就continue
回复
10975037 2004-08-06
string str_bargaintype
declare type_cur cursor for
select bargaintypename from
bargaintype;
open type_cur;
FETCH type_cur INTO :str_bargaintype;
lb_1.additem(str_bargaintype)
DO WHILE sqlca.sqlcode = 0
FETCH type_cur INTO :str_bargaintype;
lb_1.additem(str_bargaintype)
LOOP

close type_cur;
回复
lzheng2001 2004-08-06
....

FETCH type_cur INTO :str_bargaintype;
lb_1.additem(str_bargaintype)

DO WHILE sqlca.sqlcode = 0
FETCH type_cur INTO :str_bargaintype;
lb_1.additem(str_bargaintype)
LOOP

close type_cur;
回复
相关推荐
发帖
PowerBuilder
创建于2007-09-28

868

社区成员

PowerBuilder 相关问题讨论
申请成为版主
帖子事件
创建了帖子
2004-03-01 11:07
社区公告
暂无公告