^-^!
这个是products.asp的原代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--#include file="conn.asp"-->
<!--#include file="css.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
dim sort_id, sort_name
dim totalPut
dim CurrentPage, TotalPages
if request("sort_id")<>"" then
sort_id=request("sort_id")
else
sort_id=0
end if
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
set rs = server.createobject("adodb.recordset")
'set rs1=server.createobject("adodb.recordset")
sql="select * from sort where sort_id="&cstr(sort_id)
rs.open sql,conn
if not rs.eof then
sort_name=rs("sort_name")
end if
rs.close
set rs=nothing
%>
<title><%=sort_name%> </title>
<style type="text/css">
<!--
.border-right {
border-right-width: 1px;
border-top-style: none;
border-right-style: solid;
border-bottom-style: none;
border-left-style: none;
border-right-color: #000000;
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body topmargin="0" bgcolor="#666666">
<table width="760" height="" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="760" height="22" background="imgs/topborder.jpg"><table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td width="260"> </td>
<td width="120"> </td>
<td width="120" style="font-size:9pt;color:#666666"><div align="center">加入收藏夹</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="22" bgcolor="#FFFFFF"><img src="imgs/Logo.jpg" width="520" height="66"></td>
</tr>
<tr>
<td bgcolor="#D2D2D2"> </td>
</tr>
<tr>
<td width="760" height="40"><table width="760" height="40" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="294"><img src="imgs/s_f001.jpg"></td>
<td width="76"><A href="index.asp"
onmouseout=MM_swapImgRestore()
onmouseover="MM_swapImage('Image25','','imgs/s_b01.jpg',1)"><IMG
border=0 height=40 name=Image25 src="imgs/s_f01.jpg" alt="首页"
width=76></A></td>
<td width="76"><A href="introduct.asp"
onmouseout=MM_swapImgRestore()
onmouseover="MM_swapImage('Image26','','imgs/s_b02.jpg',1)"><IMG
border=0 height=40 name=Image26 src="imgs/s_f02.jpg" alt="公司简介"
width=76></A></td>
<td width="20"><img src="imgs/s_f002.jpg"></td>
<td width="76"><A href="contact.asp"
onmouseout=MM_swapImgRestore()
onmouseover="MM_swapImage('Image27','','imgs/s_b03.jpg',1)"><IMG
border=0 height=40 name=Image27 src="imgs/s_f03.jpg" alt="联系我们"
width=76></A></td>
<td width="20"><img src="imgs/s_f002.jpg"></td>
<td width="76"><A href="products.asp?sort_id=1"
onmouseout=MM_swapImgRestore()
onmouseover="MM_swapImage('Image28','','imgs/s_b04.jpg',1)"><IMG
border=0 height=40 name=Image28 src="imgs/s_f04.jpg" alt="产品介绍"
width=76></A></td>
<td width="12"><img src="imgs/s_f004.jpg"></td>
<td width="76"><A href="lm/default.asp"
onmouseout=MM_swapImgRestore()
onmouseover="MM_swapImage('Image29','','imgs/s_b05.jpg',1)"><IMG
border=0 height=40 name=Image29 src="imgs/s_f05.jpg" alt="留言板"
width=76></A></td>
<td width="34"><img src="imgs/s_f005.jpg"></td>
</tr>
</table></td>
</tr>
</table>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#D2D2D2"> </td>
<td bgcolor="#D2D2D2"> </td>
</tr>
<tr bgcolor="#D2D2D2">
<td> </td>
<td><form action="search.asp" method="post" name="search" target="_blank">
<table width="640" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="160"><input name="pro_name" type="text" size="20" maxlength="20" value="请输入您要查询的产品名" style="height:20;color:#999999;"></td>
<td width="50"> <%set rs5=server.createobject("adodb.recordset")
sql5 = "select * from sort"
rs5.open sql5,conn
if rs5.eof and rs5.bof then
response.write "请先添加栏目。"
response.end
else%>
<select name="sort_id" size="1"><option selected value="">所有商品</option>
<% dim selclass
selclass=rs5("sort_id")
do while not rs5.eof
%>
<option value="<%=trim(rs5("sort_id"))%>"><%=trim(rs5("sort_name"))%></option>
<%rs5.movenext
loop
end if
rs5.close
%>
</select></td>
<td width="70"><div align="right">
<input name="imageField" type="image" src="imgs/search_col.jpg" width="56" height="22" border="0">
</div></td>
<td bgcolor="#D2D2D2"> </td>
</tr>
</table>
</form></td>
</tr>
<tr bgcolor="#D2D2D2"> </tr>
<tr>
<td width="120"><img src="imgs/pro_feng.jpg" width="120" height="22"></td>
<%set rs=server.createobject("adodb.recordset")
sort_id=trim(request("sort_id"))
if sort_id=empty then
response.redirect "index.asp"
end if
page=request.querystring("page")'如果是从这一页发出的查询请求就会存在这个字符串
if page="" then page=1
if not(isnumeric(page)) then page=1
if page<1 then page=1
page=CInt(page)
if sort_id<>0 then
sql="select * from products where sort_id="+cstr(sort_id)+" order by product_id desc"
else
sql="select * from products order by product_id desc"
end if
rs.open sql,conn
if rs.eof then
response.write "你所选的类别没有商品"
response.end
else
rs.pagesize=10
totalrec=rs.recordcount
totalpage=rs.pagecount
if page>totalpage then page=totalpage
rs.AbsolutePage=page
rs.cachesize=rs.pagesize
i=0
dim product_id,pro_name,pro_style,pro_img,pro_int
do while not rs.eof and (i<rs.pagesize)
i=i+1
redim preserve product_id(i),pro_name(i),pro_style(i),pro_img(i),pro_int(i)
product_id(i)=rs("product_id")
pro_name(i)=rs("pro_name")
pro_style(i)=rs("pro_style")
pro_img(i)=rs("pro_img")
pro_int(i)=rs("pro_int")
rs.movenext
loop
end if
rs.close
%>
<td bgcolor="#D2D2D2">类别:<b><%=sort_name%></b></td>
</tr>
<tr>
<td bgcolor="#D2D2D2" class="border-right"> </td>
<td bgcolor="#D2D2D2"><div align="center"><strong>第
<font color=#FF6600><%=page%></font>页/
共<font color=#FF6600><%=totalpage%></font>
页
<font color=666666>
<%if page-1>0 then%><!-- 显示上一页的链接 -->
<a href="products.asp?sort_id=<%=sort_id%>&page=<%=page-1%>">上一页</a>
<%else%>
上一页
<%end if%>
<%if page+1<=totalpage then%><!-- 显示下一页的链接 -->
<a href="products.asp?sort_id=<%=sort_id%>&page=<%=page+1%>">下一页</a>
<%else%>
下一页<!-- 如果不是这个条件,那么就只有字样,没有链接 -->
<%end if%>
</font></strong></div></td>
</tr>
<tr bgcolor="#D2D2D2">
<td valign="top"><table width="120" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="border-right">
</td>
</tr>
</table></td>
<td valign="top"> <%
for i=1 to ubound(product_id)
%>
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10"></td>
<td colspan="2" width="300"><img src="<%=pro_img(i)%>" width="300" height="288"></td>
<td width="10"></td>
</tr>
<tr>
<td> </td>
<td width="70">品名:</td>
<td width="230"><%=pro_name(i)%></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>型号:</td>
<td width="230"><%=pro_style(i)%></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>简介:</td>
<td width="230"><%=pro_int(i)%></td>
<td> </td>
</tr>
</table>
<%next%>
</td>
</tr>
<tr bgcolor="#D2D2D2">
<td valign="top"> </td>
<td valign="top"><div align="center"><strong>第
<font color=#FF6600><%=page%></font>页/
共<font color=#FF6600><%=totalpage%></font>
页
<font color=666666>
<%if page-1>0 then%><!-- 显示上一页的链接 -->
<a href="products.asp?sort_id=<%=sort_id%>&page=<%=page-1%>">上一页</a>
<%else%>
上一页
<%end if%>
<%if page+1<=totalpage then%><!-- 显示下一页的链接 -->
<a href="products.asp?sort_id=<%=sort_id%>&page=<%=page+1%>">下一页</a>
<%else%>
下一页<!-- 如果不是这个条件,那么就只有字样,没有链接 -->
<%end if%>
</font></strong></div></td>
</tr>
</table>
<!--#include file="bottom.htm"-->
<br>
</body>
</html>
有浏览器中执行出现的错误:
错误类型:
ADODB.Recordset (0x800A0BB9)
参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
/hualw/products.asp, 第 198 行
我研究了好多天了,都不知道是什么错误,别人告诉可能是page的数据类型不对,我用vartype输出后,得到一个2,不知道是不是数值的意思??没有办法了,现在贴出来,希望大家帮忙了,谢谢