这里主要提到事务的概念,有一个典型的例子,银行转帐,
a帐户转100到b帐户,需要执行两条语名
update account set n_money=n_money-100 where id='a'
update account set n_money=n_money+100 where id='b'
两条语句必须不可分隔必须同时成功或同时失败的,这样就需要写成;
update account set n_money=n_money-100 where id='a'
if sqlca.sqlcode=0 then
update account set n_money=n_money+100 where id='b'
if sqlca.sqlcode=0 then
commit Using sqlca;
messagebox('','OK!')
else
messagebox('err','e2')
end if
else
messagebox('err','e1')
end if