📄 search.asp
字号:
<%Response.Buffer=True%>
<!--#Include file="odbc_connection.asp"-->
<html>
<head>
<title>查找客户记录</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style type="text/css">
<!--
body,td,th {
font-size: 14px;
}
body {
background-color: #FFFDEE;
}
-->
</style
</head>
<body>
<% If session("id")="" Then
Response.Redirect "index.asp"
end if
%>
<h2 align="center">查找成员</h2>
<center>
<form method="post" action="">
<table border="0" width="90%" bgcolor="#CC9933">
<tr>
<td>客户姓名关键字:</td><td><input type="text" name="name" size="20" ></td>
<td><input type="submit" value=" 确 定 "></td>
</tr>
<table>
</form>
<%
'如果没有输入姓名关键字就不执行下列语句
If Trim(Request("name"))<>"" Then
'建立Recordset对象
Dim rs,strSql
Set rs=Server.CreateObject("ADODB.Recordset")
'以姓名为关键字查找
strSql="Select * From users Where name Like '%" & Trim(Request("name")) & "%'"
rs.Open strSql,db,1 '要应用Count属性,要用键盘指针
If rs.RecordCount<=0 Then
Response.Write "对不起,没有找到信息"
Else
Response.Write "共找到" & rs.RecordCount & "条记录"
%>
<table border="0" width="90%">
<tr bgcolor="#FF9900" align="center">
<td width=10%>姓名</td>
<td width=15%>联系方式</td>
<td width=25%>性别</td>
<td width=20%>住址</td>
<td width=10%>年龄</td>
<td width=20%>备注</td>
</tr>
<%
Do While Not rs.Eof
Response.Write "<tr bgcolor='#CC9933' align='center'>"
Response.Write "<td>" & rs("name") & "</td>"
Response.Write "<td>" & rs("tel") & " </td>"
Response.Write "<td>" & rs("sex") & "</td>"
Response.Write "<td>" & rs("home") & "</td>"
Response.Write "<td>" & rs("age") & "</td>"
Response.Write "<td>" & rs("intro") & "</td>"
Response.Write "</tr>"
rs.MoveNext
Loop
End If
End If
%>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -