当前位置:编程学习 > C#/ASP.NET >>

[Microsoft][ODBC Microsoft Access Driver] 语法错误 (操作符丢失) 在查询表达式 'mn_id=631 and id

<!--#include file="conn.asp" -->
<%
strCurrMenu="631"
ThisPage=request.ServerVariables("URL")
strQuery=""
strTitle="最新发布"
if GetVariable("class")<>"" then
SourCode=conn.execute("Select c_code From web_jian_class Where mn_id=" & strCurrMenu & " and id="&GetVariable("class"))(0)
strQuery=strQuery
strTitle=GetVariable("classname")
end if
'
if GetVariable("key")<>"" then
strQuery=strQuery & " And (nTitle Like '%" & GetVariable("key") & "%' or nHtmlText like '%" & GetVariable("key") & "%' or nKey like '%" & GetVariable("key") & "%') "
strTitle="搜索:" & GetVariable("key")
end if
'
'从这开始读数据
strSQL="Select * From web_jian Where nAuthor<>'0' " & strQuery & " And mn_id=" & strCurrMenu & " Order by ID Desc"
'
rs.open strSQL,conn,1,1
if rs.bof or rs.eof then 
response.write " "
response.end
end if 
nHtmlText=rs("nHtmlText")
%>
<html>
<head>
<title>公司简介</title>
<META content="拒" 
name=description>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
background-image: url(images/bakground1.jpg);
background-color: #FFFFFF;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-repeat: repeat;
}
.STYLE1 {color: #000000}
-->
</style>
<link href="css/sty.css" rel="stylesheet" type="text/css">
<link href="css/style_cn.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE3 {color: #999999}
-->
</style>
<link href="css/style_cn.css" rel="stylesheet" type="text/css">
</head>

<body text="#000000" BodyBegin>
<table width="956" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td width="3" height="108" bgcolor="#FFFFFF"></td>
    <td valign="top"><!--#include file="aboutmetop.asp"--></td>
    <td width="3" height="108" bgcolor="#FFFFFF"></td>
  </tr>
</table>
<table width="956" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="212" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="address">
      <tr>
        <td><img src="images/company aboat0.jpg" width="224" height="45"></td>
      </tr>
      <tr>
        <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tbody>
                <tr></tr>
                <%
'开始输出分类
strcode=""
for i=1 to Len(SourCode) \ 4
strcode=strcode&" or c_code like '"&left(SourCode,i*4)&"____'"
next
if strcode<>"" then
strcode="(1<>1"&strcode&" or Len(c_code)=4)"
else
strcode=" Len(c_code)=4"
end if
strSQL="Select * From web_jian_class Where mn_id=631 and " & strcode & "  Order by c_code"
'Select * From web_jian_class Where mn_id=633 and Len(c_code)=4 Order by c_code 
'response.Write(strsql)
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.open strSQL,conn,1,1
for i=1 to rs.recordcount
Level=(Len(rs("c_code"))/4-1)*3
%>
                <tr>
                  <td height="35" valign="top" class="abc"><img src="images/share_left_icon.gif" width=6 vspace=1 border=0>
                      <%
If Len(rs("c_code"))>4 Then Response.Write "├"
Response.Write String(Level,"-")
%>
                    <a href="?class=<%=rs("id")%>&classname=<%=trim(rs("c_name"))%>"><%=trim(rs("c_name"))%></a> </td>
                </tr>
                <tr></tr>
                <%
rs.movenext
next
%>
              </tbody>
            </table></td>
      </tr>
      
      <tr></tr>
    </table></td>
    <td width="744" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="address">
      <tr>
        <td><table width="100%" height="82" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td height="82"><img src="images/aboat2.jpg" width="724" height="87"></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table width="100%" height="176" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <TD rowspan="3" vAlign=top><%=nHtmlText%></TD>
            </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
<br>
<table width="956" border="0" cellpadding="0" cellspacing="0" class="address0">
  <tr>
    <td> </td>
  </tr>
</table>
<br>
<TABLE width=956 border=0 align="center" cellPadding=0 cellSpacing=0>
  <TBODY>
    <TR>
      <TD width="136" height=25 align=left vAlign=middle bgColor=#F4F5F7 class=fon1><span class="STYLE3"><img src="images/imon logo.jpg" width="135" height="60"></span><br>
          <br></TD>
      <TD width="581" align=left vAlign=middle bgColor=#F4F5F7 class=fon1><br></TD>
      <TD width="239" align=right vAlign=top bgColor=#F4F5F7 class=fon1> </TD>
    </TR>
    <TR>
      <TD height=25 colspan="3" align=center vAlign=bottom bgColor=#F4F5F7 class=fon1> </TD>
    </TR>
  </TBODY>
</TABLE>
<br>
<script language="JavaScript" src="common/init.js"></script><br><script language=Javascript src="common/tranbig5.Js"></script>
</body>
</html> --------------------编程问答-------------------- 怎么asp也出来了
在 把数据库的 id列 变成 CInt(id) 看看
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,