我正在执行 .vbs 文件并在其中调用存储过程。
function getJobHistory(byval ServerName)
'****************************
'* Connecting to server
dim rsArray
msgbox(ServerName)
cn.open "Provider=SQLOLEDB.1;Data Source=" & ServerName & ";Integrated Security=SSPI"
cmd.activeconnection =cn
MsgBox(cn.State)
If Err.Number <> 0 Then
Call HandleErrors(Err.Number, Err.Description, "Error Connecting To Server " & ServerName & "")
end if
'cmd.commandtext = "SELECT * FROM SYS.SYSDATABASES"
'query1="SELECT * FROM SYS.SYSDATABASES"
sql = "exec UMRDB..sp_Getobsoletebackupfile 0,0,0,'','','','',0,'','','',0"
mobjwritelog.Write(query)
'query=query & " insert into UMRDB..FileInfo select * from #fileinfo"
'query=query & " drop table #disk drop table #file"
'cmd.commandtext = query
'rs.Open query,cn
set rs=cn.Execute(sql)
'MsgBox(rs.RecordCount)
do while not rs.BOF and not rs.EOF
rsArray=rs.GetRows()
nr=UBound(rsArray,2)
MsgBox(nr)
rs.MoveNext
loop
rs.Close
' end if
end function
'***********************
它给了我如下错误
Error: Operation is not allowed when the object is closed.
Code: 800A0E78
Source: ADODB.Recordset
在查询分析器中执行相同的存储过程。执行过程需要 17 秒。当我在 .vbs 脚本或 asp 页面上执行时会发生什么。