我建立了一个简单的物资查询网页,首先通过在select.html网页表单中输入查询方式以及关键字,然后通过调用search.asp文件来查找所需内容以及生成相应表单,但始终有错误,想了很久得不到解决,希望高手指点。各文件代码如下:
select.html:<p>
<html> <head> <meta http-equiv="Content-Language" content="zh-cn"> <meta name="GENERATOR" content="Microsoft FrontPage 6.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>查询物资</title> </head> <body bgcolor="#3399FF"> <form method="post" action="search.asp"> <p> <p> <p> <p align="center"> <font size="6" face="华文琥珀">物资查询系统</font><p align="center"> <font size="2"><a href="index.htm">回首页</a> <a href="showall.asp"> 总览记录</a> 帮助 </font> <p>请选择搜寻类别: <br> <p></p> <input type="radio" name="kind" value="物资编号">物资编号 <input type="radio" name="kind" value="物资名称">物资名称 <input type="radio" name="kind" value="物资价格">物资价格 <input type="radio" name="kind" value="物资类型">物资类型 <p></p> <hr> </p> <br> <p>请输入关键字:<input type="text" name="keyword" size="50"></p> <input type="submit" value="开始查询"> <input type="reset" value="重新输入"> </form> </body> </html>
<p>
search.asp:<p>
<% dim kind, keyword kind=request("kind") keyword=request("keyword") %> <html> <body> <% dim objconn set objconn=server.createobject("adodb.connection") objconn.connectionstring="driver={microsoft access driver (*.mdb)};"&"dbq="&server.mappath("firm.mdb") objconn.open dim objrs,strsql set objrs=server.createobject("adodb.recordset") strsql="select * from 物资表 where kind "&like&" '%"&keyword&"%'" objrs.open strsql,objconn,1,3,2 %> <table border="1"> <tr> <% for i=0 to objrs.fields.count -1 response.write "<th>"&objrs.fields(i).name&"</th>" next %> </tr> <% Do while Not objrs.eof data="<tr>" for i=0 to objrs.fields.count -1 data=data&"<td>"&objrs.fields(i).value&"</td>" next response.write data&"</tr>" objrs.movenext Loop objrs.close set objrs=nothing objconn.close set objconn=nothing %> </table> </body>
</html>
[此贴子已经被作者于2004-11-11 12:52:23编辑过]