新微赢技术网

标题: 出现这个问题是什么原因?? [打印本页]

作者: 小新就是我    时间: 2009-12-27 01:30
标题: 出现这个问题是什么原因??
错误类型:
Microsoft JET Database Engine (0x80040E14)
语法错误 (操作符丢失) 在查询表达式 'cataid=' 中。
/shenke/news.asp, 第 120 行


<%

set rs=server.createobject("adodb.recordset")
sql8="select * from news Where cataid= "& Nclassid &" order by id desc"
rs.open sql8,objConn,1,1 在页面中这里是第120行
If rs.Bof Or rs.Eof Then
Response.Write "This is not nothing!"
%>
<%

Else
if not isempty(request("page")) then
pagecount=cint(request("page"))
else
pagecount=1
end if
rs.pagesize=18
if pagecount>rs.pagecount or pagecount<=0 then
pagecount=1
end if
rs.AbsolutePage=pagecount
i=1
Do while not rs.eof and i<=rs.pagesize

%>
作者: 君临贵妃    时间: 2009-12-27 01:30
Nclassid的值为空,检查接收到值没有。
作者: 我是医师    时间: 2009-12-27 01:30
没解决.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp" -->
<!--#include file=conn2.asp-->
<% Nclassid=request.QueryString("Nclassid") %>
<%
Sub page(par)
response.Write("<table width='97%' border='0' align='left' class='hongda'> ")
response.Write("<tr>")
response.Write("<td align='left'>")
if rs.pagecount>1 then
response.Write "现为第"&pagecount&"页/共 "&rs.pagecount&"页&nbsp;&nbsp;"
if pagecount>=10 then
response.write"<a href="&par&"?Nclassid="&request("Nclassid")&"&page="&(((cstr(pagecount)\10)-1)*10)+1&">UP</a>&nbsp;"
end if
q=(cstr(pagecount)-1)\10
if q<0 then
q=1
end if
p=(q*10)+1
do while p<((q*10)+11)
If p=pagecount Then
Response.Write p & "&nbsp"
Elseif p<=rs.pagecount then
Response.Write "<a href='"&par&"?Nclassid="&request("Nclassid")&"&page="&p&"'>"&p&"</a>&nbsp"
End If
p=p+1
loop
A=rs.pagecount
if (A mod 10)=0 then
A=rs.pagecount-1
end if
if pagecount<(A\10)*10 then
response.write"<a href="&par&"?Nclassid="&request("Nclassid")&"&page="&((((cstr(pagecount)-1)\10)+1)*10)+1&">NEXT</a>"
end if
End If
response.Write("</td>")
response.Write("</tr>")
response.Write("</table>")
End Sub
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>浙江申科滑动轴承有限公司--公司主要生产交直流电机、汽轮发电机、汽轮机、水轮机、风机、水泵、压缩机及其他旋转机器用的轴承</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image: url();
}
-->
</style>
<link href="css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
a:link {
color: #990000;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #990000;
}
a:hover {
text-decoration: underline;
color: #666666;
}
a:active {
text-decoration: none;
}
-->
</style></head>

<body>
<table width="1003" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/NEWS_1.jpg" width="1003" height="118"></td>
</tr>
</table>
<table width="1003" border="0" align="center" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="293"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><img src="images/NEWS_2.jpg" width="293" height="102" border="0" usemap="#Map"></td>
</tr>
<tr>
<td height="405" valign="top" background="images/NEWS_7.jpg"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="293" height="405">
<param name="movie" value="fla/hg.swf">
<param name="quality" value="high">
<embed src="fla/hg.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="293" height="405"></embed>
<param name="wmode" value="transparent">
</object></td>
</tr>
</table></td>
<td background="images/NEWS_11.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/NEWS_3.jpg" width="710" height="94"></td>
</tr>
</table> <table width="100%" height="405" border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="230" align="right"><img src="images/NEWS_5.jpg" width="186" height="261"></td>
<td width="455"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10">&nbsp;</td>
<td width="445" valign="top"><table width="100%" height="29" border="0" align="center" cellpadding="0" cellspacing="0" class="www">
<tr>
<td height="14" class="fff">新闻标题</td>
<td width="19%" align="left" class="fff">查看次数</td>
</tr>
<tr>
<td height="3" colspan="2"></td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="lianzhou">
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="hongda">
<%

set rs=server.createobject("adodb.recordset")
sql8="select * from news Where cataid="& request("Nclassid") &" order by id desc"
rs.open sql8,objConn,1,1
If rs.Bof Or rs.Eof Then
Response.Write "This is not nothing!"
%>
<%

Else
if not isempty(request("page")) then
pagecount=cint(request("page"))
else
pagecount=1
end if
rs.pagesize=18
if pagecount>rs.pagecount or pagecount<=0 then
pagecount=1
end if
rs.AbsolutePage=pagecount
i=1
Do while not rs.eof and i<=rs.pagesize

%>
<tr>
<td width="77%" valign="top" class="ddd"><a href='index1_news.asp?id=<%=rs("id")%>&Nclassid=<%=rs("cataid")%>' target="_blank" class="a1"><%=rs("title")%></a> </td>
<td width="23%" valign="top" class="ddd">[已被查看<%=rs("hits")%>次]</td>
</tr>
<%
i=i+1
rs.movenext
Loop
End If
%>
</table>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" class="ddd"><%Call page("index9.asp")%></td>
</tr>
</table></td>
</tr>
<%
rs.close
set rs=nothing
objConn.close
set objConn =nothing
%>
</table></td>
</tr>
</table>
</td>
<td bgcolor="#FFFFFF">&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
<table width="1003" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/NEWS_9.jpg" width="1003" height="48"></td>
</tr>
</table>
<map name="Map">
<area shape="rect" coords="84,32,267,52" href="news.asp">
<area shape="rect" coords="83,59,268,79" href="news-hy.asp">
</map>
</body>
</html>
作者: 老子xin坏    时间: 2009-12-27 01:30
sql8="select * from news Where cataid= "& request("Nclassid") &" order by id desc"
可解决此问题
作者: 風雲々無心メ    时间: 2009-12-27 01:30
要说得具体点俺是刚起步的.
作者: 寂寞男孩    时间: 2009-12-27 01:30
Nclassid这个变量没有接到值。

sql8="select * from news Where cataid= "& Nclassid &" order by id desc"
把这条语句下面的值先暂时注释掉,然后再在这条语句下面加一语句。
Response.Write sql8
看看SQL语句是否正确显示出来了。
作者: 飘香剑雨    时间: 2009-12-27 01:30
还没解决就可能问题没有出在这个地方,上一个页面。
作者: 陪你疯→想你    时间: 2009-12-27 01:30
你学到了什么呢?
如果没有思考去来为什么,我想,这是没有任何意义的.
作者: 幻影    时间: 2009-12-27 01:30
<%

set rs=server.createobject("adodb.recordset")
sql8="select * from news Where cataid=12 order by id desc"
rs.open sql8,objConn,1,1 在页面中这里是第120行
If rs.Bof Or rs.Eof Then
Response.Write "This is not nothing!"
%>


这样就OK了.
作者: 追风少年    时间: 2009-12-27 01:31
谢了.




欢迎光临 新微赢技术网 (http://bbs.weiying.cn/) Powered by Discuz! X3.2