主题:  一个站内查询问题........

我有BLOG了

职务:普通成员
等级:4
金币:16.8
发贴:2209
#12003/6/4 16:49:38
我有一个ASP程序用了很久,但是查询功能一直修理不好.......

此查询,查找空字符,他回提示我,查询的是空字符,查没有的东西也可以查,但是查到已经有的名称,它就会提示.....

ADODB.Recordset 错误 '800a0cc1'

在对应所需名称或序数的集合中,未找到项目。

/ziyuan/flash2/search.asp,行158

我把这个SEARCH.ASP的代码提出来.是这样的....

<%
dim rstype
dim typesql
dim typeid,typename1
if not isEmpty(request("typeid")) then
typeid=request("typeid")
else
typeid=0
end if
set rstype=server.createobject("adodb.recordset")
typesql="select * from type where typeid="&typeid&""
rstype.open typesql,conn,1,1
if not rstype.eof then
    typename1=rstype("type")
else typename1="全部FLASH"    
end if
rstype.close
'---------------------------search----------------------
name=trim(request("keyword"))
name=replace(name,"'","''")
'Response.Write name
if typeid=0 then
sql="select * from learning where title Like '%"& name &"%' or title like title Like '%"& name &"%' or title Like '%"& name &"%'order by articleid desc"
else
sql="select * from learning where (typeid="&typeid&") and (title Like '%"& name &"%' or title like title Like '%"& name &"%' or title Like '%"& name &"%') order by articleid desc"
end if
set rs=conn.execute(sql)
'Rsponse.Write rs.RecordCount
if name="" then
'response.redirect"index.asp"
response.write"查找字符不能为空串,请重输入查找的信息返回重查"
response.end
elseif rs.eof then
response.write"没有你要查找的信息返回重查"
response.end
else
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
'set rs=server.createobject("ADODB.recordset")
'rs.open sql,conn
'searchsub rs
end if
%> <%
const MaxPerPage=10
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim typename
typename="软件搜索结果"
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
set rst=server.CreateObject("ADODB.RecordSet")
%>



查找结果























<%
' dim sql
'dim rs
'if request("hits")="1" then
' sql="select * from learning order by hits desc"
'else
' sql="select * from learning order by articleid desc"
'end if
'Set rs= Server.CreateObject("ADODB.Recordset")
'rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "

还 没 有 任 何 软 件

"
else
     'totalPut=rs.recordcount
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
     if (totalPut mod MaxPerPage)=0 then
     currentpage= totalPut \ MaxPerPage
     else
     currentpage= totalPut \ MaxPerPage + 1
     end if

end if
if currentPage=1 then
showpage totalput,MaxPerPage,"search.asp"
showContent
showpage1 totalput,MaxPerPage,"search.asp"
else
if (currentPage-1)*MaxPerPage rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showpage totalput,MaxPerPage,"search.asp"
showContent
showpage1 totalput,MaxPerPage,"search.asp"
else
     currentPage=1
showpage totalput,MaxPerPage,"search.asp"
showContent
showpage1 totalput,MaxPerPage,"search.asp"
     end if
     end if
rs.close
end if
    
set rs=nothing
conn.close
set conn=nothing


sub showContent
dim i
     i=0
%>



<%i=0
do while not rs.eof%>













<% i=i+1
     if i>=MaxPerPage then exit do
     rs.movenext
     loop
         %>








运行系统:<%=rs("runsystem")%>

作者信箱:">回信作者

">评论 <%=rs("reviewcount")%>
 篇


" target="_blank">" width="120" height="87">



 名称:" target="_blank"><%=rs("title")%>  
 
)">网友投票:<%=rs("vote")%>


 
时间: <%=rs("dateandtime")%>  大小:<%=rs("dog")%>K 

观看:<%=rs("hits")%>次 
评价:<%=rs("softlevel")%> 



 
简介:<%=rs("content")%>




<%
end sub
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
Response.Write ""
response.write ""
response.write ""
response.write ""    
response.write "
"
Response.Write "共有软件:"&totalnumber&""&CurrentPage&"/"&n&"
"'
response.write "软件搜索:"
Response.Write ""

response.write    " "
response.write "
"
if CurrentPage<2 then
response.write "首页 上一页 "
else
response.write "首页 "
response.write "上一页 "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "下一页 尾页"
end if
Response.Write "
"
'response.write " 页次: "
'response.write " 共"&totalnumber&"个软件 "&maxperpage&"个软件/页 "
'response.write " 转到:"
' response.write "

"
end function
function showpage1(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
Response.Write ""
response.write "
"
gotopage
response.write "
"
if CurrentPage<2 then
response.write "首页 上一页 "
else
response.write "首页 "
response.write "上一页 "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "下一页 尾页"
end if
Response.Write "
"
'response.write " 页次: "
'response.write " 共"&totalnumber&"个软件 "&maxperpage&"个软件/页 "
'response.write " 转到:"
' response.write "

"
end function
sub gotopage%>
" method="POST" id="form2" name="form2">
转到


<%end sub
function showpage1(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
Response.Write ""
response.write "
"
gotopage
response.write "
"
if CurrentPage<2 then
response.write "首页 上一页 "
else
response.write "首页 "
response.write "上一页 "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "下一页 尾页"
end if
Response.Write "
"
'response.write " 页次: "
'response.write " 共"&totalnumber&"个软件 "&maxperpage&"个软件/页 "
'response.write " 转到:"
' response.write "

"
end function
function showpage4(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "
"
response.write "

>>分页 "
if CurrentPage<2 then
response.write "首页 上一页 "
else
response.write "首页 "
response.write "上一页 "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "下一页 尾页"
end if
response.write " 页次:"&CurrentPage&"/"&n&"页 "
response.write " 共"&totalnumber&"个软件 "&maxperpage&"个软件/页 "
response.write " 转到:"
response.write "

"
end function
%>











在这里里面和整个程序我没有发现.home2.asp这个文件.........是缺少文件导致的吗?




今晚在线

职务:普通成员
等级:3
金币:1.0
发贴:761
#22003/6/4 17:39:05
这么长的代码从何看起,应该说说有什么具体问题!



我有BLOG了

职务:普通成员
等级:4
金币:16.8
发贴:2209
#32003/6/4 19:36:21
今晚在线在上个帖子中说
引用:
这么长的代码从何看起,应该说说有什么具体问题! :cool:


代码内有这么一句.....


这句是不是就代表,我的站点文件里面必须有home2.asp,对吗?



绿茶

职务:普通成员
等级:8
金币:10.0
发贴:19267
#42003/6/4 20:45:35
OF COURSE



缺缺

职务:管理员
等级:8
金币:41.0
发贴:9620
#52003/6/4 21:02:40
看在对应所需名称或序数的集合中,未找到项目的错误提示似乎你的某地字段数据库中并不存在.你检查一下拼写看看



我有BLOG了

职务:普通成员
等级:4
金币:16.8
发贴:2209
#62003/6/4 21:22:23
好,谢谢楼上两位大哥.......