回 帖 发 新 帖 刷新版面

主题:锁问题,求大师指教。

下面代码的想法:
    先根据第一条SELECT语句读取客户的上次余额hkamnt,然后根据该hkamnt计算出当前余额后进行第二条insert语句。为避免在计算过程中该客户的余额发生变化,需要对该表进行锁定。

   求加锁的方法!!!!


t3='张三'
t2=1000.00
tmpsql="select top 1 * from hktab where hkkh=?t3 order by hk_id DESC"
  =SQLExec(lnHandle,tmpsql,"CursorEmp")
   sele CursorEmp
   count to aa
    if aa>0
      go top
      tmpamnt=hkamnt-t2
    else
      tmpamnt=0-t2
    endif
  tmpsql="INSERT INTO hktab(hkdat,hkkh,hkds,hkdf,hkin,hkout,hkamnt,dno) VALUES(?t1,?t3,0,0,0,?t2,?tmpamnt,'付款')"
  =SQLExec(lnHandle,tmpsql,"CursorEmp")

回复列表 (共1个回复)

沙发

急啊!!没人知道吗?

我来回复

您尚未登录,请登录后再回复。点此登录或注册