我写了程序,但是实现不了,按如图查找的效果啊。我写程序后,只要一按搜索,把所有产品都搜出来了。代如下:
<%
dim field,sort_id,keyword
field=request.form("field")
classname=request.form("classname")
keyword=request.form("keyword")
if field="产品名称" then
field="shop_name"
elseif field="产品说明" then
field="introduce"
end if
set rs=server.createobject("ADODB.Recordset")
sql="SELECT * FROM product where '%"&field&"%' and '%"&classname&"%' and '%"&keyword&"%'"
set rs=conn.execute(sql)
if rs.bof and rs.eof then
response.write"<script language=javascript>alert('对不起没有您所需的产品!');history.go(-1)</script>"
else
%>
<TABLE cellSpacing=0 cellPadding=0 width="98%" align=center border=0>
<TBODY>
<TR>
<TD height=2></TD></TR>
<TR>
<TD height=26> <IMG height=16
src="images/HaoSc23.png" width=14 align=absMiddle>
<font size="3"><b>产 品 展 示 中 心</b></font></TD>
</TR>
<TR>
<TD bgColor=#cbe0e9 height=2></TD></TR></TBODY></TABLE>
<a href="product.asp">产品展示</a> >> 统计查询共有
<% Response.Write(rs.RecordCount) %>条纪录</a><BR><br>
<table width="442" height="159" border="1" align="center" bordercolor="#62C0FF" style="border-collapse: collapse">
<%do until rs.eof%>
<tr>
<td width="92" rowspan="2">
<A href="ProductShow.asp?shop_id=<%=rs("shop_id")%>">
<%if rs("pic")<>"" then %>
<img src=admin/pic/<%=rs("pic")%> width=125 border=0>
<%else%>
<img src=admin/pic/no.jpg width=125 border=0>
<%end if%>
</A>
</td>
<td width="66" align="center">产品名称</td>
<td width="262"><A href="ProductShow.asp?shop_id=<%=rs("shop_id")%>"><%=rs("shop_name")%></A></td>
</tr>
<tr>
<td align="center" bgcolor="#F2F2F2">产品说明</td>
<td bgcolor="#F2F2F2"><%=rs("introduce")%></td>
</tr>
<%
rs.movenext
loop
%>
</table>