ADODB.Recordset错误' 800a0e7d'该连接不能用于执行此操作。在此上下文中它是关闭的或无效的

时间:2015-01-26 10:37:40

标签: sql ms-access

我收到此错误,我无法找到解决方案.. 我不是sql专家,有人告诉我语法不正确,是吗?

ADODB.Recordset error '800a0e7d' 
The connection cannot be used to perform this operation. It is either closed or invalid in this context. 
/SelectBanner.inc, line 9 

内部的SelectBanner.inc:

<%
    sql5 = "SELECT * " &_
            "FROM Banners " &_
            "WHERE BannerNum="&thelocation&" AND TheLanguage='hebrew'"

    Set BannersRS = Server.CreateObject("ADODB.Recordset")
    BannersRS.Open sql5, conn, 3, 1

    TotalRecords = 0

    DO WHILE not (BannersRS.eof)
        TotalRecords=TotalRecords+1
        BannersRS.MoveNext
    LOOP

    If (not(BannersRS.bof)) Then
        BannersRS.MoveFirst
    End If

    rndMax = TotalRecords

    x=0
%>

这是“connection.asp”文件:

<!--#include file=security.asp--> 
<% 
    set conn = server.createobject("ADODB.connection") 'the next code needed for times when the connection is included from other places than /httpdocs/ 
    ar = Split(server.mappath("."),"\") 
    NewPath = ar(0) 'get the c:\ 
    If ar(index) = "httpdocs" Then 
        index = UBound(ar) 
    Next 
    NewPath = NewPath&"\Data\xxxxxx.mdb" 
    conn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&NewPath&";Persist Security Info=False" 
    conn.open() 
    set rs = conn.execute("select * from siteInfo") 
    taxValue = rs("tax") 
    set rs = nothing 
%>

0 个答案:

没有答案