| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 863 人关注过本帖
标题:语法错误 (操作符丢失) 在查询表达式 'id=' 中。/cpxxxx.asp, 第 10 行
只看楼主 加入收藏
jining2011
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-9-20
结帖率:0
收藏
已结贴  问题点数:0 回复次数:6 
语法错误 (操作符丢失) 在查询表达式 'id=' 中。/cpxxxx.asp, 第 10 行
<!--#include file="conn.asp" -->
<!--#include file="yzadmin/ips.asp"-->  导入的页面

<%
    set rstts=server.createobject("adodb.recordset")
    rstts.open "select * from product where id="&request.form("id"),conn,3,1  这就是第十行
%>
<title><%=rstts("sitetitle")%></title>
<meta name="keywords" content="<%=rstts("sitekeywords")%>" />
<meta name="description" content="<%=rstts("sitedes")%>" />
<link href="div.css" rel="stylesheet" type="text/css" />
<link href="css.css" rel="stylesheet" type="text/css" />

    <table width="1000" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top"><div class="lefttop"><div class="leftfont"><a href="<%=ips%>zxdt.asp">最新动态</a></div>
    </div><div class="leftmiddle"><div class="zxdtdiv">
                                                                                                                                <%
                                    set rst=server.createobject("adodb.recordset")
                                    sql="select top 10 * from dongtai where tuijian='是' order by id desc"
                                    rst.open sql,conn,3,1
                                    do while not rst.eof
                                    response.write "<li><a href='"&ips&"zxdtarticle.asp?id="&rst("id")&"'>"&left(rst("title"),16)&"</a>&nbsp;&nbsp;&nbsp;</li>"
                                    rst.movenext
                                    if rst.eof then exit do
                                    loop
                                    rst.close
                                    set rst=nothing
                                %>
                                                                                                                             </div></div><div class="leftbottom"></div>
        <div class="lefttop">
          <div class="leftfont"><a href="<%=ips%>cpdq.asp">产品大全</a></div>
        </div>
        <div class="leftmiddle"><div class="cpxxdiv">
                                           <%
                                    set rst=server.createobject("adodb.recordset")
                                    sql="select top 15 * from cpdq where tuijian='是' order by id desc"
                                    rst.open sql,conn,3,1
                                    do while not rst.eof
                                    response.write "<li><a href='"&ips&"cpdqarticle.asp?id="&rst("id")&"'>"&left(rst("title"),18)&"</a>&nbsp;&nbsp;&nbsp;</li>"
                                    rst.movenext
                                    if rst.eof then exit do
                                    loop
                                    rst.close
                                    set rst=nothing
                                %>                                            </div></div><div class="leftbottom"></div>
        <div class="lefttop"><div class="leftfont"><a href="<%=ips%>tlzs.asp">涂料知识</a></div>
        </div><div class="leftmiddle"><div class="tlzsdiv">
                                                                                                   <%
                                    set rst=server.createobject("adodb.recordset")
                                    sql="select top 15 * from tlzs where tuijian='是' order by id desc"
                                    rst.open sql,conn,3,1
                                    do while not rst.eof
                                    response.write "<li><a href='"&ips&"tlzsarticle.asp?id="&rst("id")&"'>"&left(rst("title"),18)&"</a>&nbsp;&nbsp;&nbsp;</li>"
                                    rst.movenext
                                    if rst.eof then exit do
                                    loop
                                    rst.close
                                    set rst=nothing
                                %>
                                                                                                   </div></div><div class="leftbottom"></div></td>
    <td valign="top"><div style="padding:9px;">位置:<a href="<%=ips%>index.asp">公司首页</a> >> <a href="<%=ips%>cpxx.asp">产品信息</a> >> <%=rstts("name")%></div>
        <div class="cp1"><div class="middletopfont1"><a href="<%=ips%>cpxx.asp">防腐涂料展示</a></div></div><div

class="cp2">         <h1><%=rstts("name")%></h1>   
                    <%=rstts("content")%>
                    <%
                       rstts.close
                       set rstts=nothing
                      set rst=server.CreateObject("adodb.recordset")
                      rst.open "select top 1 * from  product where id > "&request("id")&" order by id asc",conn,3,1
                      if rst.eof and rst.bof then
                          cp1="暂无上一产品"
                      else                     
                          cp1="上一产品:&nbsp;&nbsp;<a href='"&ips&"cpxxxx.asp?id="&rst("id")&"'>"&left(rst("name"),20)&"…</a>"
                      end if
                      rst.close
                      set rst=nothing
            
                      set rst=server.CreateObject("adodb.recordset")
                      sql="select top 1 * from product where id < "&request("id")&" order by id desc"
                      rst.open sql,conn,3,1
                      if rst.eof and rst.bof then
                          cp2="暂无下一产品"
                      else                     
                          cp2="下一产品:&nbsp;&nbsp;<a href='"&ips&"cpxxxx.asp?id="&rst("id")&"'>"&left(rst("name"),20)&"…</a>"
                      end if
                      rst.close
                      set rst=nothing                                       
                    %>    <table width="100%" border="0" cellpadding="5" cellspacing="1">
                    <tr>
                        <td width="50%" ><%=cp1%></td>
                        <td width="50%" ><%=cp2%></td>
                    </tr>
                </table>
                    </div><div class="cp3"></div></td>
  </tr>
</table>

    </td>
  </tr>
搜索更多相关主题的帖子: content include product 表达式 
2011-09-20 10:46
towering
Rank: 7Rank: 7Rank: 7
等 级:黑侠
威 望:1
帖 子:261
专家分:507
注 册:2007-10-9
收藏
得分:3 
试一下:

rstts.open "select * from product where id="&Request.QueryString("id"),conn,3,1

我的ASP小站:http://www./
2011-09-20 13:23
jining2011
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-9-20
收藏
得分:0 
抱歉,还是不对,相同的错误。
2011-09-20 15:18
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:3 
有传递id这个值吗?

在这句rstts.open "select * from product where id="&request.form("id"),conn,3,1 前面加
response.write("id="&request.form("id"))
response.end

重新试一下,看id=后面有没有值

----我怎能在别人的苦难面前转过脸去----
2011-09-20 15:37
jining2011
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-9-20
收藏
得分:0 
回复 4楼 dzt0001
额,你好,我试着加上了那句话,但是运行之后是酱紫的。

id=     



其他的什么都没有。这是什么原因啊?是不是还少什么东西?
2011-09-22 08:34
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:0 
表单值没有传过来。检查一下表单页是否有name="id"的控件

----我怎能在别人的苦难面前转过脸去----
2011-09-22 14:15
kangli_kl
Rank: 6Rank: 6
等 级:侠之大者
威 望:2
帖 子:134
专家分:489
注 册:2008-4-5
收藏
得分:3 
这样写:
id=request.form("id")
sql="select * from product where id=" &id
然后输出一下sql看看sql有没有问题
response.write(sql)

求上而得中,求中而得下。
2011-09-22 15:32
快速回复:语法错误 (操作符丢失) 在查询表达式 'id=' 中。/cpxxxx.asp, 第 10 行 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.085505 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved