我在经典的 asp 应用程序中收到以下错误:
用于 ODBC 驱动程序的 Microsoft OLE DB 提供程序错误“80004005”
事务不能有多个具有此游标类型的记录集。更改游标类型、提交事务或关闭记录集之一。
我正在将代码从 Oracle 迁移到 SQL Server 2008,这是我在整个应用程序中不断看到的问题。
似乎找不到任何修复它。
此代码块中的这种特殊情况:(我更改了选择以使其更短)
Set MyConn = Server.CreateObject("ADODB.Connection")
Call OpenORPSConnect(MyConn)
ql = "Select username from mytable"
set rs = MyConn.Execute(sql)
if not rs.EOF then username = rs(0)
if username = "" then username = theUser
rs.close()
set rs = nothing
MyConn.BeginTrans()
sql = "Select someReport from MyTable"
set rs = MyConn.Execute(sql)
do while not rs.EOF
TIMESTAMP = rs("TIMESTAMP")
rev = rs("REV")
select case whatChange
case "Target date"
sql = "Insert into " & caJustTable & _
" (TEXT, TIMESTAMP, CURRENTFLAG)" & _
" Values ( Text& "','" & COPY_TS & "', 'Y')""
MyConn.Execute(sql)
end select
sql = "update table, set this to that"
MyConn.Execute(sql) <-------- error happens here sometimes....
end if
rs.movenext
loop
rs.close()
set rs = nothing