<
%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
'patrn是用户输入的搜索字段,strng是数据库的相关的字段
Function search(patrn)
dim count1,count2
count1=0
count2=0
set conn=server.CreateObject("adodb.connection")
conn.open "dsn=xinda;uid=Welcome"
set rs=conn.execute("select m_name,id from movie_list")
len_str=len(patrn)
'response.Write("你要搜索的影片是:"&patrn&"<br>")
if len_str<>0 then
do while not rs.eof
' response.Write(temp)
for i=1 to len_str
for n=1 to len_str-i+1
m=n-i+1
temp=mid(patrn,i,n)
serch=rs.fields("m_name").value
'response.Write(temp&"<br>")
if cmpstr<>serch and instr(serch,temp) then
count1=count1+1
result=result&"这是搜索的相关的影片:<font color=red>"&rs.fields("m_name").value&"</font>---影片id是:"&rs.fields("id").value&"<br>"
cmpstr=serch
end if
next
next
rs.movenext
count2=count2+1
loop
if count1=0 then
response.Write("对不起,没有你要搜索的影片!<br>")
else
response.Write(result&"---共搜索了"&count2&"个文件找到"&count1&"个影片---<br>")
end if
else
response.Write("查询字符不能为空")
end if
End Function
'call search("周")
aaa=request.querystring("inptsearch")
response.Write("要搜索的影片是:"&aaa&"<br>")
search(aaa)
%>
刚写完的代码,你应该可以用,可以匹配“007”中任意的顺序字符集