asp 模糊搜索问题?

<%DimRecordset1__MMColParamRecordset1__MMColParam="1"If(Request.Form("aa")<>"")ThenRe... <%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.Form("aa") <> "") Then
Recordset1__MMColParam = Request.Form("aa")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = connstr
Recordset1.Source = "SELECT * FROM 表 WHERE 字段 LIKE '%" + Replace(Recordset1__MMColParam, "'", "''") + "%' ORDER BY id DESC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1_numRows = 0
%>

请问怎样实现在提交的值中加入空格也不影响搜索的结果?就像百度一样?
展开
 我来答
mngenius
2007-01-14 · TA获得超过3165个赞
知道大有可为答主
回答量:2192
采纳率:0%
帮助的人:0
展开全部
改为
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.Form("aa") <> "") Then
Recordset1__MMColParam = trim(Request.Form("aa"))
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = connstr
Recordset1.Source = "SELECT * FROM 表 WHERE 字段 LIKE '%" & Recordset1__MMColParam & "%' ORDER BY id DESC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1_numRows = 0
%>
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
蓝色无限
2007-01-14 · 超过16用户采纳过TA的回答
知道答主
回答量:123
采纳率:0%
帮助的人:67.1万
展开全部
Recordset1.Source = "SELECT * FROM 表 WHERE 字段 LIKE '%" + Replace(Replace(Recordset1__MMColParam, "'", "''")," ","") + "%' ORDER BY id DESC"
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式