谁能解决给100分

x98188 2003-11-16 07:44:27
小弟不才有个问题请教大家
http://x98188.uni.cc/amway/list.asp?classid=1
的下一页老是出错:错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
/ne/list.asp, 第 7 行
错误原因:[Microsoft][ODBC Microsoft Access Driver] 语法错误 (操作符丢失) 在查询表达式 'classid=' 中。

详细描述:
代码如下:
<!--#include file="conn.asp"-->
<!--#include file="Util.asp" -->
<%
classid="classid="&cstr(request("classid"))&" and "
set rs1=server.createobject("ADODB.Recordset")
sql1="select class from class where classid="&cstr(request("classid"))
rs1.open sql1,conn,3,2
%>

<%

set rs2=server.createobject("ADODB.Recordset")
sql2="Select * From Nclass where classid="&cstr(request("classid"))
rs2.open sql2,conn,3,2
%>


<html>
<head>
<title></title>
<script language="javascript" type="text/javascript">
<!--
function MM_reloadid(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadid; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadid(true);
//-->
</script>
</head>
<link rel="stylesheet" type="text/css" href="globalstyle.css">
<body bgcolor="#efefef">
<div align="center"><center>

<table border="1" width="450" cellpadding="0" cellspacing="0" bordercolorlight="#000000" bordercolordark="#FFFFFF">


</table>

<div align="center"></div>
<table width="98%" border="0" align="center">
<tr>
<td bgcolor="#efefef">您的位置:<A href="default.asp">amway首页</A> <img border="0" src="images/More.gif">
<%=rs1("class")%> <img border="0" src="images/More.gif"> <div id="Layer1" style="position:absolute; width:200px; height:115px; z-index:2; left: 20px; top: 106px;">
<table width="79%" height="31" border="0" bordercolor="#000000">
<%
while (not rs2.eof)
%>
<tr>
<td height="25"> <a href="list.asp?classid=<%=request("classid")%>&Nclassid=<%=rs2("Nclassid")%>"><%=rs2("Nclass")%></a>
</td>
</tr>
<%
rs2.movenext
wend
%>
</table>
</div></td>
</tr>
</table>
<p> </p>
<p>

</p>



<div id="Layer2" style="position:absolute; width:510px; height:115px; z-index:1; left: 210px; top: 73px;">
<%
page=request.querystring("page")
set rs=server.createobject("ADODB.Recordset")
if request("Nclassid")="" then
sql="Select * From product where classid="&cstr(request("classid"))

else
sql="select * from product where Nclassid="&request("Nclassid")

end if
rs.open sql,conn,1,3
maxjilu=rs.recordcount

t=page*4
rs.absoluteposition=t+1
f=t+4
for i=t+1 to f
idd=rs("id")
%>
<table width="98%" height="73" border="1">
<tr>
<td width="13%" rowspan="5"><a href="detail.asp?id=<%=rs("id")%>"><img src="adm/<%=rs("content")%>" alt="" width="57" height="75" border="0"></a></td>
<td width="87%">名称:<%=rs("name")%></td>
</tr>
<tr>
<td>编号:<%=rs("bianhao")%></td>
</tr>
<tr>
<td>市场价:<%=rs("marktprice")%></td>
</tr>
<tr>
<td>会员价:<%=rs("memprice")%></td>
</tr>
<tr>
<td><a href="detail.asp?id=<%=rs("id")%>">详细介绍</a>     <a href="#" onClick="***********('add.asp?cpbm=<%=rs("ProductID")%>','add','scrollbars=no,resizable=no,width=650,height=450 top=10,left=10')">购物</a></td>
</tr>
</table>
<table>

<%
rs.movenext
if rs.eof then
exit for
rs.close
conn.close
end if
next
tt=page*4
if page<0 then
page=0
end if
if tt>=maxjilu then
ttt=page-1
end if
if maxjilu-tt<4 then
ttt=page-1
else
ttt=page
end if
u=1
do while u*4<maxjilu
u=u+1
loop
session("page")=ttt


%>

<table width="97%" border="0">
<tr>
<td>
<td height="22" align="center" class="jnfont3"> <p align="right">共<%=u%>页
第<%=(page+1)%>页 | <a href=list.asp?page=0>首页</a>-<a href=list.asp?page=<%=(ttt-1)%>>上
页</a>-<a href=list.asp?page=<%=(ttt+1)%>>下页<a/>-</a><a href=list.asp?page=<%=(u-1)%>>末页</a>
<%
if ttt<=4 then
uu=0
while uu<u
%>
<a href=list.asp?page=<%=(uu)%>>[<%=(uu+1)%>]</a>
<%uu=uu+1
wend
else%>
<a href=list.asp?page=<%=(ttt-2)%>>[<%=(ttt-3)%>]</a> <a href=list.asp?page=<%=(ttt-1)%>>[<%=(ttt-2)%>]</a>
<a href=list.asp?page=<%=(ttt)%>>[<%=(ttt-1)%>]</a> <a href=list.asp?page=<%=(ttt+1)%>>[<%=(ttt)%>]</a>
<a href=list.asp?page=<%=(ttt+2)%>>[<%=(ttt+1)%>]</a>
<%end if%>
<p> </p></td>
</tr>
</table>

</div>


<p><br>
<br>
</p>
</body>
</html>

...全文
547 40 打赏 收藏 转发到动态 举报
写回复
用AI写文章
40 条回复
切换为时间正序
请发表友善的回复…
发表回复
DeltaCat 2003-11-17
  • 打赏
  • 举报
回复
我肯定,我的方法是对啊
DeltaCat 2003-11-17
  • 打赏
  • 举报
回复
楼主啊,我也不知道怎么说了,写好的代码给你,你自己照搬进去,你都弄成这个样子。。。
phoenixsbk 2003-11-17
  • 打赏
  • 举报
回复
"但出现:
Microsoft VBScript 编译器错误 (0x800A0408)
/ne/list.asp, 第 143 行, 第 22 列
Response.Write((ttt-1)%&classid=<%=request("classid"))
---------------------^"
当然不对,你把%都贴进去了,怎么可能对,把这句去掉
phoenixsbk 2003-11-17
  • 打赏
  • 举报
回复
你现在的页面上仍然没有把分页时的classid打上去,我看到的连接是http://x98188.uni.cc/amway/list.asp?page=1
就象你说的,没有把classid传入
会织网的蚂蚁 2003-11-16
  • 打赏
  • 举报
回复
http://x98188.uni.cc/amway/list.asp?classid=1&page=2
你看这个地址有什么问题
把你的连接写成这样试试。
会织网的蚂蚁 2003-11-16
  • 打赏
  • 举报
回复
你看一下你的?page=..
DeltaCat 2003-11-16
  • 打赏
  • 举报
回复
是你自己写的有问题,我不是给你写过了吗?
你写的这是什么?
x98188 2003-11-16
  • 打赏
  • 举报
回复
搞了啊还是不行啊,会不会是:

原因是“下页”时classid没有传入

<td height="22" align="center" class="jnfont3"> <p align="right">共<%=u%>页
第<%=(page+1)%>页 | <a href=list.asp?page=0>首页</a>-<a href=list.asp?page=<%=(ttt-1)%>>上
页</a>-<a href=list.asp?page=<%=(ttt+1)%>>下页<a/>-</a><a href=list.asp?page=<%=(u-1)%>>末页</a>

改为

<td height="22" align="center" class="jnfont3"> <p align="right">共<%=u%>页
第<%=(page+1)%>页 | <a href=list.asp?page=0&classid=<%=request("classid")%>>首页</a>-<a href=list.asp?page=<%=(ttt-1)%&classid=<%=request("classid")%>>上
页</a>-<a href=list.asp?page=<%=(ttt+1)%>&classid=<%=request("classid")%>>下页<a/>-</a><a href=list.asp?page=<%=(u-1)%>&classid=<%=request("classid")%>>末页</a>

但出现:
Microsoft VBScript 编译器错误 (0x800A0408)
/ne/list.asp, 第 143 行, 第 22 列
Response.Write((ttt-1)%&classid=<%=request("classid"))
---------------------^

DeltaCat 2003-11-16
  • 打赏
  • 举报
回复
你把按我的方法改的页面传上去我看看
x98188 2003-11-16
  • 打赏
  • 举报
回复
还是不行
zhengxianping 2003-11-16
  • 打赏
  • 举报
回复
sql1="select class from class where classid="&cstr(request("classid"))
这句话如果你的数字型就classid是不要再转换了
sql1="select class from class where classid="&request("classid")
还有你打开数据库时记得要关闭
xsdqa 2003-11-16
  • 打赏
  • 举报
回复
sql1="select class from class where classid="&cstr(request("classid"))&""
x98188 2003-11-16
  • 打赏
  • 举报
回复
改了都是这样一来啊
x98188 2003-11-16
  • 打赏
  • 举报
回复
还是这个错误
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
/ne/list.asp, 第 9 行
错误原因:[Microsoft][ODBC Microsoft Access Driver] 语法错误 (操作符丢失) 在查询表达式 'classid=' 中。

详细描述:
DeltaCat 2003-11-16
  • 打赏
  • 举报
回复
这是个分页的程序,你自己参考一下
DeltaCat 2003-11-16
  • 打赏
  • 举报
回复
<%
Dim PageSize,PageCount,CurPage,i

PageSize = 20 '指定每页显示的条数

CurPage = Trim(Request.QueryString("page"))

If CurPage = "" Then
CurPage = 1
Else
CurPage = CInt(CurPage)
End If

Set rs = Server.CreateObject("ADODB.Recordset")

With rs
.Open "Select * from table order by id desc",adodbConnection,1,1
'其中 table 是你的表名,adodbConnection是你数据库连接
If .Eof and .Bof Then
.Close
Response.Write "No Record"
Response.End
End If
.PageSize = PageSize
PageCount = .PageCount
If .PageCount < CurPage Then
.AbsolutePage = .PageCount
Else
.AbsolutePage = CurPage
End If

For i = 1 to .PageSize
%>

[B]这里写你要显示的内容[/B]

<%
.MoveNext
If .Eof Then Exit For
Next
.Close
End With
Set rs = nothing
%>
其他内容,可有可无
<%
'这里是下一页,上一页部分,此部分还可以细化
If CurPage > 1 Then
Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?page=" & CStr(CurPage - 1) & """>前一页</a> "
End If
If CurPage < PageCount Then
Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?page=" & CStr(CurPage + 1) & """>后一页</a> "
End If
%>
x98188 2003-11-16
  • 打赏
  • 举报
回复
上面说的我都改了,不行就不行,天意如此,咳算了,谢谢大家拉
DeltaCat 2003-11-16
  • 打赏
  • 举报
回复
还是我改给你吧:
第<%=(page+1)%>页 | <a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?page=0">首页</a>-<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?page=<%=ttt-1%>">上
页</a>-<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?page=<%=ttt+1%>">下页<a/>-</a><a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?page=<%=(u-1)%>">末页</a>


其他部分自己改
DeltaCat 2003-11-16
  • 打赏
  • 举报
回复
你哪里改了?
x98188 2003-11-16
  • 打赏
  • 举报
回复
有劳这个大哥拉,就算搞不了,我觉得还是要给你加分啊
加载更多回复(20)

28,405

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧