filter.asp
来自「ASP入门与提高实用教程 源文件(上传网站)」· ASP 代码 · 共 35 行
ASP
35 行
<!--#include file="conn.asp"--> <%'包含conn.asp文件,该文件用来打开Connection对象,
'使用Include文件可以免去在每个ASP程序中写连接语句的麻烦%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>过滤器</title>
</head>
<body>
<%
Dim rs
Set rs=Server.CreateObject("ADODB.Recordset") '创建Recordset对象
rs.Open "eword",conn,1,1 '打开eword表
For strletter= 1 to 26 '重复过程26次,一次针对字母表中的一个字母
strChar = Chr(strletter+64)
strSQL = "word LIKE '"&strChar&"*'" 'strSQL变量存放包含过滤条件的串,word为列名
rs.Filter=strSQL '使用过滤器过滤记录集
If Not rs.Eof Then
Response.Write"<h2>" & strChar & "</h2>" &_
"<Table Border=1><TR><TD><B>English<b></td><TD>Mean</td></tr>"
Do While Not rs.Eof 'Eof属性为True表示记录集中没有数据,此时不显示任何内容
Response.Write "<TR><TD>" & rs("word") & "</td>" &_
"<td>" & rs("mean") & "</td></tr>"
rs.MoveNext
Loop
Response.Write"</table>"
End If
Next
Set rs=Nothing '关闭Recordset记录集
Set conn=Nothing '关闭Connection记录集
%>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?