<% dim kind, keyword kind=request("sort") 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>
想根据选择的物资种类以及输入的关键字来模糊查找数据库并列成表格形式,SQL语句有问题,
但不知道怎么改?