[求助]各位老大 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
%>
麻烦大家看看为什么出错了,谢谢