| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 681 人关注过本帖
标题:[求助]多条件组合查询SQL有语法错误
取消只看楼主 加入收藏
towering
Rank: 7Rank: 7Rank: 7
等 级:黑侠
威 望:1
帖 子:261
专家分:507
注 册:2007-10-9
结帖率:100%
收藏
 问题点数:0 回复次数:0 
[求助]多条件组合查询SQL有语法错误
我的代码如下:
<%
Dim result__MM_xmmc
result__MM_xmmc = "%"
if (Request.QueryString("xmmc") <> "") then result__MM_name = Request.QueryString("xmmc")
%>
<%
Dim result__MM_sjh
result__MM_sjh = "%"
if (Request.QueryString("sjh") <> "") then result__MM_Author = Request.QueryString("sjh")
%>
<%
Dim result__MM_xkz
result__MM_Date = "%"
if (Request.QueryString("xkz") <> "") then result__MM_Date = Request.QueryString("xkz")
%>
<%
Dim result__MM_jine1
result__MM_Price1 = "1"
if (Request.QueryString("jine1") <> "") then result__MM_Price1 = Request.QueryString("jine1")
%>
<%
Dim result__MM_jine2
result__MM_Price2 = "9999"
if (Request.QueryString("jine2") <> "") then result__MM_Price2 = Request.QueryString("jine2")
%>
<%
Dim result__MM_zrfs
result__MM_Quality = "%"
if (Request.QueryString("zrfs") <> "") then result__MM_Quality = Request.QueryString("zrfs")
%>
<%
Dim result__MM_sqr
result__MM_Summary = "%"
if (Request.QueryString("sqr") <> "") then result__MM_Summary = Request.QueryString("sqr")
%>
<%
Dim result__MM_srr
result__MM_Sort = "%"
if (Request.QueryString("srr")  <> "") then result__MM_Sort = Request.QueryString("srr")
%>
<%
Dim result__MM_sort
result__MM_Sort = "ID"
if (Request.QueryString("sort")  <> "") then result__MM_Sort = Request.QueryString("sort")
%>
<%
Dim result__MM_mianji1
result__MM_Price1 = "1"
if (Request.QueryString("mianji1") <> "") then result__MM_Price1 = Request.QueryString("mianji1")
%>
<%
Dim result__MM_mianji2
result__MM_Price2 = "9999"
if (Request.QueryString("mianji2") <> "") then result__MM_Price2 = Request.QueryString("mianji2")
%>
<%
Dim result__MM_Array
result__MM_Array = "DESC"
if (Request.QueryString("array")  <> "") then result__MM_Array = Request.QueryString("array")
%>
<%
Dim rs
Dim rs_cmd
Dim rs_numRows

Set rs_cmd = Server.CreateObject (")
rs_cmd.ActiveConnection = MM_conn_STRING
rs_ = "SELECT *  FROM dbo.jianzheng  WHERE xmmc LIKE '%" + Replace(result__MM_xmmc, "'", "''") + "%'   AND sjh LIKE '%" + Replace(result__MM_sjh, "'", "''") + "%'   AND xkz LIKE '" + Replace(result__MM_xkz, "'", "''") + "'   AND " + Replace(result__MM_jine1, "'", "''") + " < jine AND jine < " + Replace(result__MM_jine2, "'", "''") + "'   AND " + Replace(result__MM_mianji1, "'", "''") + " < mianji AND mianji < " + Replace(result__MM_mianji2, "'", "''") + "   AND zrfs LIKE '" + Replace(result__MM_zrfs, "'", "''") + "'   AND sqr LIKE '%" + Replace(result__MM_sqr, "'", "''")+ "'   AND srr LIKE '%" + Replace(result__MM_srr, "'", "''") + "%'  ORDER BY " + Replace(result__MM_Sort, "'", "''") + " " + Replace(result__MM_Array, "'", "''") + ""
rs_cmd.Prepared = true
rs_cmd.Parameters.Append rs_cmd.CreateParameter("param1", 200, 1, 50, rs__MMColParam) ' adVarChar

Set rs = rs_cmd.Execute
rs_numRows = 0
%>


结果错误:
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]第 1 行: '<' 附近有语法错误。
/search_finish.asp,行 74 (红色部分)


麻烦高手给看下,谢谢!
搜索更多相关主题的帖子: SQL 语法 条件 查询 
2008-07-02 09:43
快速回复:[求助]多条件组合查询SQL有语法错误
数据加载中...
 
   



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

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