【发布时间】:2019-11-21 07:08:08
【问题描述】:
我已经从其他一些对此问题的回复中浏览并实施了代码,但我仍然没有运气。我仍然收到错误消息。
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
作为最后的手段,我将返回存储过程并对其进行解构,以确保一切正常。有没有人知道为什么我可能会收到错误?我不会在任何地方关闭。
这里是 ExecuteCommand 函数 -
Function ExecuteCommand(s,i)
On Error Resume Next
Set ExecuteCommand = oDBc.Execute(s, , i)
End Function
【问题讨论】:
-
多年来没有做过经典 ASP,但我尝试的第一件事是将“dim oRs”移到 if 语句之外。
-
那行不通。我有另一个以相同方式设置的文件,它可以工作,只是调用了一个不同的存储过程。这是我继承的代码。
-
你确定IF块中的代码正在执行吗?
-
我们需要查看
ExecuteCommand方法的代码——有问题。
标签: asp-classic vbscript adodb