ASP搜索结果怎么显示排序,我想让它显示三行三列,代码如下
<html><head><metahttp-equiv="Content-Type"content="text/html;charset=gb2312"><title>文...
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>文件</title>
</head>
<body bgcolor="#ffffff">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<script>
function btn_ck_bh_Click()
{
var cx = document.form1.cxsj.value;
form1.action ="products1.asp?cx="+cx;
}
</script>
<table width="60%" border="0" cellpadding="1" cellspacing="1" bordercolorlight="#4DA6FF" bordercolordark="#ECF5FF" bgcolor="#F0F8FF" style="word-break:break-all">
<% cx = request("cx")
dim pageCount
page = cint(request("page"))
set conn=server.createobject("adodb.connection")'
set rs=server.createobject("adodb.recordset")
conn.open "DBQ=" & server.mappath("./data/pcfinal.mdb") & ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
if cx <> "" then
sql = "select * from pf_products where pf_products_name like '%"&cx& "%' order by id desc"
else
sql ="select * from pf_products order by id desc"
end if
rs.open sql,conn,3,3
if rs.bof then
errmsg=errmsg+"<br>"+"<li>"+keyword+"没有记录,请返回!!"
response.write errmsg
response.end
end if
RS.PageSize=3
pageCount = cint(rs.pageCount)
if page = 0 then
page =1
end if
RS.AbsolutePage = page
x=1
WHILE NOT RS.EOF AND NumRows<RS.PageSize
%>
<tr onMouseOver="this.bgColor='#99ccff'" onMouseOut="this.bgColor=''">
<td width="58%"><a href="products_view.asp?id=<%=rs("id")%>"><img src="<%=rs("pf_uploadfile")%>" width="124" height="93" alt="<%=rs("pf_products_name")%>" title="<%=rs("pf_products_name")%>" /></a> <br />
<a href="products_view.asp?id=<%=rs("ID")%>"><%=left(rs("pf_products_name"),10)%></a>
</td>
</tr>
<%RS.MoveNext
NumRows=NumRows+1
WEND%>
<tr onMouseOver="this.bgColor='#99ccff'" onMouseOut="this.bgColor=''">
<td width="105%" align="center" colspan="6"> </td> </tr>
<tr>
<td width="105%" align="center" colspan="6">
<p align="center"><FONT color=#333333>共<%=PageCount%>页 第<%=page%>页★
<%if page=1 then%>首页<%end if%>
<%if page>1 then%> 展开
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>文件</title>
</head>
<body bgcolor="#ffffff">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<script>
function btn_ck_bh_Click()
{
var cx = document.form1.cxsj.value;
form1.action ="products1.asp?cx="+cx;
}
</script>
<table width="60%" border="0" cellpadding="1" cellspacing="1" bordercolorlight="#4DA6FF" bordercolordark="#ECF5FF" bgcolor="#F0F8FF" style="word-break:break-all">
<% cx = request("cx")
dim pageCount
page = cint(request("page"))
set conn=server.createobject("adodb.connection")'
set rs=server.createobject("adodb.recordset")
conn.open "DBQ=" & server.mappath("./data/pcfinal.mdb") & ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
if cx <> "" then
sql = "select * from pf_products where pf_products_name like '%"&cx& "%' order by id desc"
else
sql ="select * from pf_products order by id desc"
end if
rs.open sql,conn,3,3
if rs.bof then
errmsg=errmsg+"<br>"+"<li>"+keyword+"没有记录,请返回!!"
response.write errmsg
response.end
end if
RS.PageSize=3
pageCount = cint(rs.pageCount)
if page = 0 then
page =1
end if
RS.AbsolutePage = page
x=1
WHILE NOT RS.EOF AND NumRows<RS.PageSize
%>
<tr onMouseOver="this.bgColor='#99ccff'" onMouseOut="this.bgColor=''">
<td width="58%"><a href="products_view.asp?id=<%=rs("id")%>"><img src="<%=rs("pf_uploadfile")%>" width="124" height="93" alt="<%=rs("pf_products_name")%>" title="<%=rs("pf_products_name")%>" /></a> <br />
<a href="products_view.asp?id=<%=rs("ID")%>"><%=left(rs("pf_products_name"),10)%></a>
</td>
</tr>
<%RS.MoveNext
NumRows=NumRows+1
WEND%>
<tr onMouseOver="this.bgColor='#99ccff'" onMouseOut="this.bgColor=''">
<td width="105%" align="center" colspan="6"> </td> </tr>
<tr>
<td width="105%" align="center" colspan="6">
<p align="center"><FONT color=#333333>共<%=PageCount%>页 第<%=page%>页★
<%if page=1 then%>首页<%end if%>
<%if page>1 then%> 展开
1个回答
展开全部
RS.PageSize=9 这里的3改为9.
.....
.....
.....
.....
......
<tr onMouseOver="this.bgColor='#99ccff'" onMouseOut="this.bgColor=''">
<%
thisnum=1
WHILE NOT RS.EOF AND NumRows<RS.PageSize%>
<td width="58%"><a href="products_view.asp?id=<%=rs("id")%>"><img src="<%=rs("pf_uploadfile")%>" width="124" height="93" alt="<%=rs("pf_products_name")%>" title="<%=rs("pf_products_name")%>" /></a> <br />
<a href="products_view.asp?id=<%=rs("ID")%>"><%=left(rs("pf_products_name"),10)%></a>
</td>
<%
if (thisnum mod 3)=0 and thisnum<9 then
response.write "</tr><tr onMouseOver=""this.bgColor='#99ccff'"" onMouseOut=""this.bgColor=''"">"
end if
RS.MoveNext
thisnum=thinum+1
NumRows=NumRows+1
WEND%>
</tr>
.....
.....
.....
.....
......
<tr onMouseOver="this.bgColor='#99ccff'" onMouseOut="this.bgColor=''">
<%
thisnum=1
WHILE NOT RS.EOF AND NumRows<RS.PageSize%>
<td width="58%"><a href="products_view.asp?id=<%=rs("id")%>"><img src="<%=rs("pf_uploadfile")%>" width="124" height="93" alt="<%=rs("pf_products_name")%>" title="<%=rs("pf_products_name")%>" /></a> <br />
<a href="products_view.asp?id=<%=rs("ID")%>"><%=left(rs("pf_products_name"),10)%></a>
</td>
<%
if (thisnum mod 3)=0 and thisnum<9 then
response.write "</tr><tr onMouseOver=""this.bgColor='#99ccff'"" onMouseOut=""this.bgColor=''"">"
end if
RS.MoveNext
thisnum=thinum+1
NumRows=NumRows+1
WEND%>
</tr>
追问
先谢谢你的回答;按你写的,它显示的不是三行三列,是一行9列,麻烦写下详细的全部代码,我试了 报错
缺少对象: 'rs'\search.asp, line 47
因为下面还有代码 写不上来 超过字数了
追答
你代码肯定套错了,在循环之外没有 rs
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询