NULL OBJECT REFERENCE求大虾

u011513236 2013-08-04 04:34:11
if dw_1.update() =1 and dw_2.update()=1 then
commit;
MessageBox('提示','数据保存成功。')
close(parent)
else
rollback;
end if

string p1,c1
int n1,n2,n3,i
integer li_count
for i=1 to dw_2.rowcount()
p1=dw_2.getitemstring(i,"pro_code")
n1=dw_2.getitemnumber(i,"cksl")
c1=dw_1.getitemstring(1,"ck_code")
select count(*) into :li_count from kctj where pro_code=:p1 and ck_code=:c1;
if li_count>0 then
select kcl into :n2
from kctj
where pro_code=:p1 and ck_code=:c1;
n3= n2 -n1
update kctj
set kcl=:n3
where pro_code=:p1 and ck_code=:c1;
elseif li_count=0 then
insert into kctj(pro_code,ck_code,kcl)
values (:p1,:c1,-:n1);
end if
next


程序运行后,显示红色字体部分:null object reference
但相同的程序我在入库单是就能运行。。。。求大虾们帮忙解决
...全文
131 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
WorldMobile 2013-08-04
  • 打赏
  • 举报
回复
if dw_1.update() =1 and dw_2.update()=1 then commit; MessageBox('提示','数据保存成功。') else rollback; return end if string p1,c1 int n1,n2,n3,i integer li_count for i=1 to dw_2.rowcount() p1=dw_2.getitemstring(i,"pro_code") n1=dw_2.getitemnumber(i,"cksl") c1=dw_1.getitemstring(1,"ck_code") select count(*) into :li_count from kctj where pro_code=:p1 and ck_code=:c1; if li_count>0 then select kcl into :n2 from kctj where pro_code=:p1 and ck_code=:c1; n3= n2 -n1 update kctj set kcl=:n3 where pro_code=:p1 and ck_code=:c1; elseif li_count=0 then insert into kctj(pro_code,ck_code,kcl) values (:p1,:c1,-:n1); end if next close(parent) 把close(parent)放在最后,就好了 你把窗口都关闭了,对象都销毁了,再引起,当然会提示空对象了

743

社区成员

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

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