经典ASP错误:关闭对象时不允许进行操作 [英] Classic ASP Error: Operation is not allowed when the object is closed

查看:160
本文介绍了经典ASP错误:关闭对象时不允许进行操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从其他一些对此问题的回答中找到并实施了代码,但是我仍然没有运气。我仍然遇到错误。

I have cruised and implemented code from some of the other responses to this question, but I'm still having no luck. I am still getting the error.

    If ((bReport And bIsDate And CheckPermissions("lotsales")) Or Request.QueryString("report")) Then
    OpenDB
    Dim oRs, sSQL, sSQL2, iCancellations, iSales, sDate, sInitDate, sEndDate, iPhaseID, iPhaseNumber, rowCount

    sInitDate = Request("startDate")
    sEndDate = Request("endDate")
    sSQL = "sp_get_lot_sales_test '" & sInitDate & "', '" & sEndDate & "', " & sPhase & ", '" & sReportView & "'"

    'response.write vbNewLine & "<!-- sql: " & sSQL & "-->" & vbNewLine
    'response.write sSQL
    'response.Flush
    Set oRs = ExecuteCommand(sSQL,1) 
End If

然后出现错误-

If (oRs.EOF) Then <-- fails here
       Response.Write("<TR><TD ALIGN=""center"">There is no data to report on!</TD></TR>")
    Else
        Do While Not oRs.EOF

作为最后的手段,我将返回存储过程并对其进行解构,以确保所有操作都正确无误。有谁对我为什么会得到错误有任何见解?我没有在任何地方发出关闭通知。

As a last resort I am going to go back to the stored procedure and deconstruct it to make sure all is well there. Does anyone have any insight as to why I might be getting the error? I am not issuing a close anywhere.

这是ExecuteCommand函数-

Here is the ExecuteCommand function -

Function ExecuteCommand(s,i)
    On Error Resume Next
    Set ExecuteCommand = oDBc.Execute(s, , i)
End Function


推荐答案

您需要一个连接对象。

set conn = server.CreateObject("adodb.connection")
set oRs = conn.execute(sSql)

这篇关于经典ASP错误:关闭对象时不允许进行操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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