标题:[求助]各位老大 ADODB.Recordset (0x800A0BB9) 错误
只看楼主
chzhm1988
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-7-24
结帖率:0
已结贴  问题点数:20 回复次数:3 
[求助]各位老大 ADODB.Recordset (0x800A0BB9) 错误
ADODB.Recordset (0x800A0BCD)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/IndexNewsList.asp, 第 164 行

IndexNewsList.asp中的代码是:

<%
dim ConnNews,ConnStrNews
dim RsNews,SqlNews,arrResult,intRows
dim NewsTitle,NewsUrl,c_filepath
dim i

Sub NewsDataConn()
    set ConnNews=Server.CreateObject("AdoDb.Connection")
    ConnStrNews = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
    ConnStrNews = ConnStrNews & Server.MapPath("news/Data/xw1023#news#07358.mdb")
    ConnNews.Open ConnStrNews
   
    If Err Then
        Err.Clear
        Set ConnStrNews=Nothing
        Response.Write "数据库连接错误!"
        Response.End
    End    If
   
End Sub

Sub EndNewsConnetion()
    ConnNews.close
    set ConnNews=nothing
End Sub

sub NewsListH()
    set RsNews=Server.CreateObject("Adodb.RecordSet")
    RsNews.Open SqlNews,ConnNews,1,1
        NewsTitle   = RsNews(0)
        NewsUrl     = RsNews(1)
        c_filepath  = RsNews(2)
        c_filepath  = replace(c_filepath,"../","")
        If c_filepath<>"" then
            c_filepath  = replace(c_filepath,"../","")
        end if
        response.Write("<h2><a href=""")
        if NewsUrl<>"" then
            Response.Write(NewsUrl)
        else
            Response.Write("news/" & c_filepath )
        end if
        response.Write(""" target=""_blank"">" & NewsTitle & "</a></h2>" & vbCrLf)
    RsNews.close
    set RsNews=nothing
end sub

sub NewsListH2()
    set RsNews=Server.CreateObject("Adodb.RecordSet")
    RsNews.Open SqlNews,ConnNews,1,1
    arrResult=RsNews.GetRows()
    intRows=UBound(arrResult,2)
    'do while not RsNews.eof
        NewsTitle   = arrResult(0,intRows)
        NewsUrl     = arrResult(1,intRows)
        c_filepath  = arrResult(2,intRows)
        c_filepath  = replace(c_filepath,"../","")
        If c_filepath<>"" then
            c_filepath  = replace(c_filepath,"../","")
        end if
        response.Write("<h2><a href=""")
        if NewsUrl<>"" then
            Response.Write(NewsUrl)
        else
            Response.Write("news/" & c_filepath )
        end if
        response.Write(""" target=""_blank"">" & NewsTitle & "</a></h2>" & vbCrLf)
    'loop
    RsNews.close
    set RsNews=nothing
end sub

sub NewsList()
    set RsNews=Server.CreateObject("Adodb.RecordSet")
    RsNews.Open SqlNews,ConnNews,1,1
    arrResult=RsNews.GetRows()
    intRows=UBound(arrResult,2)
    Response.Write("<ul>" & vbCrLf)
    for i= 0 to intRows
        NewsTitle   = arrResult(0,i)
        NewsUrl     = arrResult(1,i)
        c_filepath  = arrResult(2,i)
        If c_filepath<>"" then
            c_filepath  = replace(c_filepath,"../","")
        end if
        response.Write("<li><a href=""")
        if NewsUrl<>"" then
            Response.Write(NewsUrl)
        else
            Response.Write("news/" & c_filepath)
        end if
        response.Write(""" target=""_blank"">" & NewsTitle & "</a></li>" & vbCrLf)
        'RsNews.movenext
    next
    RsNews.close
    set RsNews=nothing
    Response.Write("</ul>" & vbCrLf)
end sub

sub NewsListB()
    set RsNews=Server.CreateObject("Adodb.RecordSet")
    RsNews.Open SqlNews,ConnNews,1,1
    arrResult=RsNews.GetRows()
    intRows=UBound(arrResult,2)
    Response.Write("<ul>" & vbCrLf)
    for i= 0 to intRows
        NewsTitle   = arrResult(0,i)
        NewsUrl     = arrResult(1,i)
        c_filepath  = arrResult(2,i)
        c_filepath  = replace(c_filepath,"../","")
        If c_filepath<>"" then
            c_filepath  = replace(c_filepath,"../","")
        end if
        if i=8 then
            response.Write("<li class=""LineBottom""><a href=""")
        else
            response.Write("<li><a href=""")
        end if
        if NewsUrl<>"" then
            Response.Write(NewsUrl)
        else
            Response.Write("news/" & c_filepath)
        end if
        response.Write(""" target=""_blank"">·" & NewsTitle & "</a></li>" & vbCrLf)
    next
    RsNews.close
    set RsNews=nothing
    Response.Write("</ul>" & vbCrLf)
end sub

'sub NewsListB()
    'set RsNews=Server.CreateObject("Adodb.RecordSet")
    'RsNews.Open SqlNews,ConnNews,1,1
    'arrResult=RsNews.GetRows()
    'intRows=UBound(arrResult,2)
    'i=1
    'do while not RsNews.eof
    '    NewsTitle   = RsNews("Title")
    '    NewsUrl     = RsNews("url")
    '    c_filepath  = RsNews("c_filepath")
    '    c_filepath  = replace(c_filepath,"../","")
    '    if i=9 then
    '        response.Write("<li class=""LineBottom""><a href=""")
    '    else
    '        response.Write("<li><a href=""")
    '    end if
    '    if NewsUrl<>"" then
    '        Response.Write(NewsUrl)
    '    else
    '        Response.Write("news/" & c_filepath)
    '    end if
    '    response.Write(""" target=""_blank"">·" & NewsTitle & "</a></li>" & vbCrLf)
    '    RsNews.movenext
    '    i=i+1
    'loop
    'RsNews.close
    'set RsNews=nothing
    'Response.Write("</ul>" & vbCrLf)
'end sub

sub NewsPicList()
    set RsPicNews=Server.CreateObject("Adodb.RecordSet")
    RsPicNews.Open SqlNews,ConnNews,1,1
    arrResult=RsPicNews.GetRows()     // 第 164 行
    intRows=UBound(arrResult,2)
    Response.Write("<ul class=""NewPic"">" & vbCrLf)
    for i= 0 to intRows
        NewsTitle   = arrResult(0,i)
        Previewimg  = arrResult(1,i)
        NewsUrl     = arrResult(2,i)
        c_filepath  = arrResult(3,i)
        If c_filepath<>"" then
            c_filepath  = replace(c_filepath,"../","")
        end if
        if NewsUrl<>"" then
            NewsUrl = NewsUrl
        else
            NewsUrl = "news/" & c_filepath
        end if
        Previewimg = "news/" & Previewimg
        response.Write("<li onmouseover=""this.className='bgcolor01'"" onmouseout=""this.className=''""><a href=""" & NewsUrl & """ target=""_blank""><img src=""" & Previewimg & """ alt=""" & NewsTitle & """ /></a><h6><a href=""" & NewsUrl & """ target=""_blank"">" & NewsTitle & "</a></h6></li>" & vbCrLf)
    next
    response.Write("<div class=""clear""></div>")
    RsPicNews.close
    set RsPicNews=nothing
    Response.Write("</ul>" & vbCrLf)
end sub


'----------------------------防SQL注入的功能添加 --------------——————————————
    'dim sql_injdata,sql_inj,sql_get,sql_data
        SQL_injdata = "'|;|%|#|select|update|insert|delete|declare|@|exec|dbcc|alter|drop|create|backup|if|else|end|and|or|add|set|open|close|use|begin|retun|as|go|exists|*|)|("
        SQL_inj = split(SQL_Injdata,"|")  
    '防止Get方法注入
        If Request.QueryString<>"" Then  
          For Each SQL_Get In Request.QueryString  
            For SQL_Data=0 To Ubound(SQL_inj)  
                if instr(Request.QueryString(SQL_Get),Sql_Inj(Sql_DATA))>0 Then  
                    Response.Write "<Script Language=javascript>alert('请不要在参数中包含非法字符尝试注入!');history.back(-1)</Script>"  
                    Response.end  
                end if  
            next  
          Next  
        End If  
    '防止Post方法注入
    If Request.Form<>"" Then  
      For Each Sql_Post In Request.Form  
        For SQL_Data=0 To Ubound(SQL_inj)  
          if instr(Request.Form(Sql_Post),Sql_Inj(Sql_DATA))>0 Then  
            Response.Write "<Script Language=javascript>alert('请不要在参数中包含非法字符尝试注入');history.back(-1)</Script>"  
            Response.end  
          end if  
        next  
      next  
    end if
%>

麻烦大家看看为什么出错了,谢谢

搜索更多相关主题的帖子: Recordset ADODB 老大 
2010-07-24 17:20
冰镇柠檬汁儿
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:北京
等 级:版主
威 望:120
帖 子:8074
专家分:6657
注 册:2005-11-7
得分:0 
你是不是少了RsPicNews.EOF的代码了?

本来无一物,何处惹尘埃
It is empty at all here, Why pm 2.5 is so TMD high!
2010-07-24 17:32
chzhm1988
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-7-24
得分:0 
恩,好像是  知道怎么添加吗,老大
2010-07-24 19:31
冰镇柠檬汁儿
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:北京
等 级:版主
威 望:120
帖 子:8074
专家分:6657
注 册:2005-11-7
得分:20 
if RsPicNews.BOF then
    arrResult=RsPicNews.GetRows()
end if
应该是这样吧

本来无一物,何处惹尘埃
It is empty at all here, Why pm 2.5 is so TMD high!
2010-07-24 20:49



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-313892-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.083565 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved