附录
(1) 数据库连接
使用ODBC驱动程序对数据库创建连接,其代码如下:<%Dim MM_xxnew_STRING MM_xxnew_STRING = \ %>
(2) 登录检验代码:
管理员登录后建立session变量 Session(\权限的合法验证 <%
Function checkPermission() If Session(\checkPermission=TRUE Else
checkPermission=FALSE End if End Function
tmpadmin=checkPermission() If tmpadmin<>TRUE then
response.redirect \如果不能通过验证,转到页面longin.asp End if %>
(3) 创建记录集代码: <%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject(\Recordset1.ActiveConnection = MM_xxnew_STRING
Recordset1.Source = \Recordset1.CursorType = 0 Recordset1.CursorLocation = 2 Recordset1.LockType = 1 Recordset1.Open() Recordset1_numRows = 0 %>
(*.mdb)};DBQ=\
添加代码: Recordset1.addnew
Recordset1 (\Recordset1 (\Recordset1.update 更新代码:
sql=\传递来的参数\conn.Execute sql 删除代码:
sql=\传递来的参数\conn.Execute sql (4) 关闭记录集 <%
Recordset1.Close() Set Recordset1 = Nothing %>
(5) 分页显示代码: <%
Dim Repeat1__numRows Dim Repeat1__index Repeat1__numRows = 3 Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows %>
<% If Recordset1.EOF And Recordset1.BOF Then %>
<% While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) %> <% If Not Recordset1.EOF Or Not Recordset1.BOF Then %> 要显示的内容部分……… <% End If%> <%
Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1 Recordset1.MoveNext() Wend %>
目前共有<%=Recordset1.RecordCount%>条记录
从第<%=(Recordset1_first)%>条到第<%=(Recordset1_last)%>条
(6) 包含文件代码:
通过包含文件可以方便的对网页进行管理操作: