【问题标题】:Error 3704 Operation is not allowed when object is closed错误 3704 对象关闭时不允许操作
【发布时间】:2013-10-24 05:11:47
【问题描述】:

我总是收到错误 3704。关闭对象时不允许操作。

Dim myConnection2, RSTitleList2        

Set myConnection2 = CreateObject("ADODB.Connection")
Set RSTitleList2 = CreateObject("ADODB.Recordset") 

myConnection2.Open "<%=connectionString%>"
sSQL1 = "Update FileInformation SET Status = 4 Where DataDefinitionID = 147 AND CustomerID = 71"
RSTitleList2.open sSQL1, myConnection2


if RSTitleList2.BOF and RSTitleList2.EOF then
    msgbox("INSERT SUCCESSFUL")
    frmProcess.cmdPublish.disabled = true

Else
    msgbox("Not SUCCESSFUL")
    msgbox(err.Number & " | " & err.description & " | " & err.Source)
End IF  

msgbox(err.Number & " | " & err.description & " | " & err.Source)

【问题讨论】:

  • 摆脱On Error Resume Next 你在某个地方,对于那些不知道如何正确使用它的人来说,这很糟糕并且非常危险。如果没有它,您现在将在尝试打开连接的行上收到有用的错误。

标签: asp-classic


【解决方案1】:

如果您向我们提供错误消息附带的行号所在的行,将会有所帮助。但是我可以在您的代码中看到一件相当奇怪的事情

myConnection2.Open "<%=connectionString%>"

为什么 里面有“connectionstring”。当您想在 html 中显示 asp 变量时使用该语法,例如

<h1>Welcome, <%= username %></h1>

当你已经在一段 asp 代码中时,试试吧

myConnection2.Open connectionString

【讨论】:

    猜你喜欢
    • 2021-10-24
    • 2016-02-29
    • 2021-05-02
    • 1970-01-01
    • 1970-01-01
    • 2019-02-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多