其实,主要精髓就是SQL语句的写法上。 之前的提取为 "select * form whattable where id="&id 插入为 "insert into whattable(xx_rs) values(' "&content&" ')" 删除为 "delete from whattable where id="&id 修改为 "update whattable set xx_rs=' "&log_content&" ' where id="&id 则查询为 "select * form whattable where xx_rs like '%"&wahtkey&"%' "
<!--#include file="conn.asp" --> <% if request.form("submit")="search" then whatzip=request.form("zipcode") Set rs = Server.CreateObject ("ADODB.Recordset") sql = "Select * from zip where zipcode like '%"&whatzip&"%' " rs.Open sql,conn,1,1 %> <% if rs.EOF and rs.BOF then response.write ("未能查到") else Do Until rs.EOF response.write("<hr>该地址是:"& rs("placename")&rs("zipcode")) response.write("<br>所在省份是:"& rs("province")) rs.MoveNext Loop end if %> <br><a href="search.asp">again</a> <% rs.close Set rs = Nothing conn.close set conn=Nothing else %> <form action="search.asp" method="post"> <input type="text" name="zipcode"> <input type="submit" name="submit" value="search"> </form> <%end if%>
以上采用like意思表示进行模糊查询,要精确查询则直接使用 sql = "Select * from zip where zipcode = '%"&whatzip&"%' "