标题: 又来求助地。。赐教 [打印本页] 作者: 夜神君 时间: 2010-1-14 02:28 标题: 又来求助地。。赐教 大家看我写的判断搜索的代码:实现的功能是判断搜索类型,并接受从表单传来的内容,进行搜索。
if request("stype")=singer then
sql="select * from nclass where nclass like '%"&request("keyword")&"%' order by nclassid desc"
elseif request("stype")=music then
sql="select * from musiclist where musicname like '%"&request("keyword")&"%' "
end if
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1 /9行
if not isempty(request.QueryString("page")) then
currentpage=cint(request.QueryString("page"))
else
currentpage=1
end if
if rs.eof and rs.bof then
if request("stype")=singer then
response.Write"<p align='center'><br><br>Sorry,未找到你想要的歌手<br><br><a href="" javascript:history.go(-1)"">点此返回</a><br><br></p>"
elseif request("stype")=music then
response.Write"<p align='center'><br><br>Sorry,未找到你想要的歌曲<br><br><a href="" javascript:history.go(-1)"">点此返回</a><br><br></p>"
end if
else
totalput=rs.recordcount
maxperpage=10
pageurl="search.asp"
if currentpage<1 then currentpage=1
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,pageurl
showcontent
showpage totalput,maxperpage,pageurl
else
if (currentpage-1)*maxperpage<totalput then
rs.move(currentpage-1)*maxperpage
dim bookmark
bookmark=rs.bookmark
showpage totalput,maxperpage,pageurl
showcontent
showpage totalput,maxperpage,pageurl
else
currentpage=1
showpage totalput,maxperpage,pageurl
showcontent
showpage totalput,maxperpage,pageurl
end if
end if
rs.close
end if
%>