⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 08_03.asp

📁 ASPTest 网络基础网页设计
💻 ASP
字号:
<html>
<head>
<title>移动光标实例</title>
</head>
<body>
<% 
Dim cn,rs,i '变量i用来表示当前记录所在位置
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "Driver={SQL Server};Server=yangwu;Database=ASPTest;" & _
          "UID=sa;PWD=admin"
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "SELECT * FROM Chapter1",cn,1
 
If Len(request("i")) = 0 Then 
  i = 1
Else
  If request("type") = "Next" Then
    i = Request("i") + 1
    For j = 1 to i-1 
      If Not rs.Eof Then rs.MoveNext
    Next
  ElseIf request("type") = "Previous" Then
    i = Request("i") - 1
    For j = 1 to i 
      If Not rs.Eof Then rs.MoveNext
    Next
    If Not rs.Bof Then rs.MovePrevious
  ElseIf request("type") = "First" Then
    i = 1
    rs.MoveFirst
  ElseIf request("type") = "Last" Then
    i = 3
    rs.MoveNext
  End If
End If
%>
<p align="center">当前记录位置<%=i%></p>
<table border="1" cellpadding="0" cellspacing="0" bordercolor="#111111" width="336" align=center>
  <tr>
    <td width="97">注册ID</td>
    <td width="97">注册密码</td>
    <td width="138">Email地址</td>
  </tr>
  <% If Not rs.Eof And Not rs.Bof Then %>
  <tr>
    <td width="97"><%=rs(0)%> </td>
    <td width="97"><%=rs(1)%> </td>
    <td width="138"><%=rs(2)%> </td>
  </tr>
  <% End If %>
</table>
<p align="center">
<% If i<>1 Then %>
<a href="08_03.asp?type=First&i=<%=i%>">MoveFirst</a>
<% Else %>
MoveFirst
<% End If %>
<% If Not rs.Eof Then %>
|<a href="08_03.asp?type=Next&i=<%=i%>">MoveNext</a>
<% Else %>
MoveNext
<% End If %>
<% If Not rs.Bof Then %>
|<a href="08_03.asp?type=Previous&i=<%=i%>">MovePrevious</a>
<% Else %>
|MovePrevious
<% End If %>
<% If i<>3 Then %>
<a href="08_03.asp?type=Last&i=<%=i%>">MoveLast</a>
<% Else %>
|MoveLast
<% End If %>
<%
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
%>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -