iam執行.vbs文件並調用存儲過程。操作無法執行對象關閉asp
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
'***********************
它給我誤差作爲在查詢分析器執行..它需要17秒來執行,當我上的.vbs執行script.or procedure.what發生以下
Error: Operation is not allowed when the object is closed.
Code: 800A0E78
Source: ADODB.Recordset
相同存儲procedurte asp頁面。
-1清理代碼,使其格式良好並刪除註釋行。 – AnthonyWJones
您使用的是哪個版本的數據庫?從Sql Server 2008升級到Sql Server 2010後,我遇到過類似的問題。如果記錄集是空的,它會'關閉'記錄集。在繼續之前,我必須檢查記錄集的狀態。 –