谁帮我看看这段应该怎么改
if dw_1.update() =1 and dw_2.update()=1 then
commit;
MessageBox('提示','数据保存成功。')
else
rollback;
end if
string p1,p2,c1,c2,t1,t2
int n1,n2,n3,i
for i=1 to dw_2.rowcount()
p1=dw_2.getitemstring(i,"pro_code")
n1=dw_2.getitemnumber(i,"rksl")
c1=trim(dw_1.getitemstring(1,"ck_code"))
select pro_code,ck_code,kcl
into :t1,:t2,:n2
from kctj
using sqlca
if p1=t1 and c1=t2 then
n3=n1+n2
update kctj
set n1=:n3
using sqlca
else
insert into kctj(pro_code,ck_code,kcl)
values(:p1,:c1,:n1)
using sqlca
end if