📄 booklist.asp
字号:
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>
<body bgcolor=#FF6600>
<table border="1" width="100%" id="table1">
<tr>
<td colspan="3">
<p align="center">图书馆藏书显示列表</td>
</tr>
<tr>
<td>书号</td>
<td>书名</td>
<td>库存数目</td>
</tr>
<%
dim bookno
dim bookname
dim nownumber
dim strConn
dim strSQL
dim objrst
strConn = "DSN=dblib;uid=;pwd=;database=db"
strSQL = "select * from Tbook"
set objrst = GetADORecordset (strConn,strSQL) '把数据库中
if objrst.bof and objrst.eof then
response.write "<html> <head>"
response.write "<title>显示书目</title>"
response.write "</head><body>"
response.write "<br><br><center><font size=5 color=navy><b>对不起,暂时没有可用的书!<br>"
response.write "</body></html>"
else
objrst.movefirst
while not objrst.eof
bookno = objrst.fields("bookno")
bookname = objrst.fields("bookname")
nownumber = objrst.fields("nownumber")
%>
<tr>
<td><%=bookno%></td>
<td><%=bookname%></td>
<td><%=nownumber%></td>
</tr>
<%objrst.movenext
wend
End if
%>
<%
'======================================================================
' GetADORecordset -- Gets an ADO recordset given a connectionstring,
' sql query string.
'
'==============================
Function GetADORecordset(strConn, strSQL)
On Error Resume Next
Dim objConnection
Dim objRecordset
Err.Clear
' Setup an ADO connection to the database:
Set objConnection = Server.CreateObject("ADODB.Connection")
Set objRecordset = Server.CreateObject("ADODB.Recordset")
objConnection.ConnectionString = strConn
objConnection.Open
Set objRecordset.ActiveConnection = objConnection
objRecordset.Source = strSQL
objRecordset.CursorLocation = 3
objRecordset.Open
If Err Then
Set GetADORecordset = Nothing
If Not HaveError() Then
SetError "GetADORecordset", Err.number, Err.Description
End If
Else
Set GetADORecordset = objRecordset
End If
End Function
%>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -