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
%>
请问怎样实现在提交的值中加入空格也不影响搜索的结果?就像百度一样? 展开
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
%>
请问怎样实现在提交的值中加入空格也不影响搜索的结果?就像百度一样? 展开
2个回答
展开全部
改为
<%
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
%>
<%
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
%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询