败。
解决的办法一,设置数据参数让我们可以读取没有提交的数据、
cn.BeginTrans cn.Execute "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED " cn.Execute "insert into tableA ....." Set rs = cn.Execute("select count(*) from tableA where ...") If rs.RecordCount > 0 Then '表A 的字段A不能从复 cn.RollbackTrans Else cn.CommitTrans End If cn.Execute "SET TRANSACTION ISOLATION LEVEL READ COMMITTED "
解决的办法二,设置INSERT 命令 参数 with (tablock) 、
cn.BeginTrans cn.Execute "insert into tableA with (tablock) ....." Set rs = cn.Execute("select count(*) from tableA where ...") If rs.RecordCount > 0 Then '表A 的字段A不能从复 cn.RollbackTrans Else cn.CommitTrans End If 解决的办法三,增加一个没有用Lock 表、
cn.BeginTrans cn.Execute "update tmpLockTable set FieldLock=1" cn.Execute "insert into tableA with (tablock) ....." Set rs = cn.Execute("select c上一页 [1] [2] [3] 下一页
|