还是老问题。关于多关键字查询
先看看我需要实现的功能,输入关键字后(main.asp)" border="0" />
点查询,出现下面这个界面(query.asp)
" border="0" />
现在出现的问题是只能实现能查询到的记录按照那样显示.没有查询的的记录则不能显示。请问各位兄弟姐妹,有没有方法指导一下:
以下是代码:(query.asp)
程序代码:
<!--#include file="conn.asp"--> <% dim pname pname=request("search1") If Trim(pname)="" Then Response.Write"<script>alert('Input Character');history.go(-1);</script>" Response.End() End If Set Rs=Server.CreateObject("Adodb.Recordset") Str=Split(pname,",") For i=0 to Ubound(Str) StrTemp=Str(i) Sql=Sql&" or proname like '%"&StrTemp&"%'" Next sql="Select * From mbcomp Where proname like '%"&Str(0)&"%'"&Sql&"" if not (rs.eof and rs.bof) then Rs.Open sql,dbconn,1,1 Response.write"<table width='760' border='0' cellspacing='1' cellpadding='2' class='tbbgcolor'>" Response.write"<tr >" Response.write"<td class='trbgcolor_1'>Product Name</td>" Do while not Rs.eof Response.write" <tr>" Response.write" <td class='trbgcolor_2'><a href='motherboard_view.asp?productid="&Rs("proid")&"'>"&Rs("proname")&"</a></td>" Response.write" <td><font color='#ff0000'>查询到记录</font></td></tr>" Rs.movenext loop Rs.movefirst Response.write"</table>" end if Rs.close : Set Rs=Nothing %>