日期:2014-05-17  浏览次数:20934 次

like查询问题
<input id="s0" type="text" value="" name="qian">

<%
dim key1
key1=request("qian")
Set rs=Server.CreateObject("ADODB.RecordSet") 
sql = "select * from sanXdingcha where allowinvite like '%"&key1&"%'"
rs.open sql,conn,1,1 
Do While Not rs.eof
%>

我想输入123即查询含带有1、2、3 的信息,而不是查询123(一百二十三的意思)

求思路求代码!谢谢

------解决方案--------------------
dim Str
dim getchar
dim sqlWhere
sqlWhere = " Where 1=0 "
For i=1 to len(Str)
getchar = mid(Str, i)
sqlWhere = sqlWhere & " or allowinvite like '%"& getchar &"%'"
Next