更新一个access表,不是SQL表。
DO WHILE .t.
ruanid=ALLTRIM(cuid)
ruanjf=jf
IF EOF()
EXIT
ENDIF
ac=SQLEXEC(handle_bd, "UPDATE cacu SET jf=?ruanjf WHERE cuid=?ruanid")
SELECT temp1
SKIP
ENDDO
如何为这段内容加上事务,确保数据完整性?
------解决方案--------------------------------------------------------
lSuccess = .T.
Locate
SQLSetprop(handle_bd, "transactions", 2)
Scan All
ruanid = Alltrim(cuid)
ruanjf = jf
If SQLExec(handle_bd, "UPDATE cacu SET jf=?ruanjf WHERE uid=?ruanid") <> 1
lSuccess = .F.
Exit
EndIf
EndScan
If lSuccess
Sqlcommit(handle_bd)
Else
Sqlrollback(handle_bd)
EndIf
SQLSetprop(handle_bd, "transactions", 1)