-
简单的asp记录查询
2013年08月08日 安全技术 热度775 查看评论
一、查询页:scan.asp
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("data.mdb")
exec="select * from user"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%><form name="form1" method="post" action="scan1.asp">
搜索:<p><br>
姓名:
<input type="text" name="name">
或 电话:
<input type="text" name="tel">
</p>
<p>
<br>
<input type="submit" name="Submit" value="搜索">
<input type="reset" name="Submit2" value="重置">
</p>
</form>二、结果显示页面:scan2.asp
<%
name=request.form("name")
tel=request.form("tel")
if tel="" then
tel="1"
end if
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("data.mdb")
exec="select * from user where name like '%"&name&"%' and tel like '%"&tel&"%'"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<table width="759" height="10" border="0">
<tr>
<th width="110" scope="col"><div align="center">姓名</div></th>
<th width="110" scope="col"><div align="center">密码</div></th>
<th width="110" scope="col"><div align="center">性别</div></th>
<th width="110" scope="col"><div align="center">城市</div></th>
<th width="110" scope="col"><div align="center">手机</div></th>
<th width="112" scope="col"><div align="center">QQ</div></th>
<th width="67" scope="col"><div align="center">备注</div></th>
</tr>
</table><table width="759" border="0" align="left" cellpadding="0" cellspacing="0">
<%do while not rs.eof%><tr>
<td width="116"><div align="center"><%=rs("name")%></div></td>
<td width="113"><div align="center"><%=rs("password")%></div></td>
<td width="116"><div align="center"><%=rs("sex")%></div></td>
<td width="113"><div align="center"><%=rs("city")%></div></td>
<td width="116"><div align="center"><%=rs("tel")%></div></td>
<td width="112"><div align="center"><%=rs("qq")%></div></td>
<td width="73"><div align="center"><%=rs("other")%></div></td>
<%
rs.movenext
loop
%>
</table>
相关日志:
- 搜索
- 文章归档
-
- 2023年7月 (19)
- 2023年6月 (20)
- 2023年5月 (4)
- 2022年11月 (11)
- 2022年10月 (9)
- 2022年7月 (22)
- 2022年6月 (39)
- 2022年5月 (17)
- 2022年4月 (1)
- 2017年3月 (1)
- 2016年11月 (1)
- 2015年11月 (6)
- 2015年8月 (24)
- 2015年7月 (43)
- 2015年6月 (28)
- 2015年5月 (34)
- 2015年4月 (38)
- 2015年3月 (35)
- 2015年2月 (28)
- 2015年1月 (31)
- 2014年12月 (14)
- 2014年11月 (8)
- 2014年10月 (8)
- 2014年9月 (7)
- 2014年8月 (13)
- 2014年7月 (22)
- 2014年6月 (26)
- 2014年5月 (14)
- 2014年4月 (16)
- 2014年3月 (13)
- 2014年2月 (17)
- 2014年1月 (23)
- 2013年12月 (19)
- 2013年11月 (18)
- 2013年10月 (17)
- 2013年9月 (15)
- 2013年8月 (21)
- 2013年7月 (15)
- 2010年8月 (1)
- 最近发表
- 站点信息
-
- 文章总数:782
- 页面总数:2
- 分类总数:14
- 标签总数:522
- 评论总数:359
- 浏览总数:624719