在事务内部的Access中执行UPDATE SQL时超出系统资源 [英] System Resources Exceeded whilst performing UPDATE SQL in Access inside Transaction

查看:477
本文介绍了在事务内部的Access中执行UPDATE SQL时超出系统资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个事务内执行一个简单的UPDATE tblTable SET DataSet=3,但是尝试运行它几秒钟后,却得到了3035-超出了系统资源.大约有3万行.

I'm performing a simple UPDATE tblTable SET DataSet=3 inside a transaction, but a few seconds after trying to run it, I get a 3035 - System Resources exceeded. There are ~30K rows.

Dim db As DAO.Database, wrk As DAO.Workspace, errCount As Long, stSQL As String

Set db = CurrentDb
Set wrk = DBEngine.Workspaces(0)
errCount = 0
wrk.BeginTrans
    Debug.Print "There are no existing entries in the selected DataSet, preparing to proceed..."
    ' - -- ---
    stSQL = "UPDATE tblImportCleaned SET DataSetID=" & Me.lstDataSets
    db.Execute stSQL, dbSeeChanges
    If db.RecordsAffected < 1 Then errCount = errCount + 1
    Me.frmImport_CleanedSubform.Requery
    ' - -- ---

If errCount = 0 Then
    If MsgBox("There were no errors, would you like to COMMIT the changes?", vbYesNo) = vbYes Then
        wrk.CommitTrans
    Else
        wrk.Rollback
    End If
Else
    wrk.Rollback
End If
wrk.Close

知道为什么会发生这种情况以及如何避免这种情况.

Any idea why this is happening and how I can avoid it please.

推荐答案

似乎正在更新整个表,即没有条件,是否确定要更新整个表,以及是否要循环更新整个表(我在您的代码中看不到循环,但您仍然可能在循环中调用此过程)系统很可能会出现此错误.

It seems to be you are updating entire table i.e without where condition, are you sure you want to update entire table and if you are updating entire table in a loop (i don't see loop in you code, still you may be calling this procedure in a loop) system has high possibility of getting this error.

这篇关于在事务内部的Access中执行UPDATE SQL时超出系统资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆