MultiScrolling Database Sample

20 篇文章 0 订阅
12 篇文章 0 订阅

<% @LANGUAGE="VBSCRIPT"  %> <% Option Explicit   %>
<!--METADATA TYPE="typelib"
uuid="00000205-0000-0010-8000-00AA006D2EA4" --><html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>MultiScrolling Database Sample</title>
</head>

<body BGCOLOR="White" topmargin="10" leftmargin="10">

<!-- Display Header -->
<p><font size="4" face="Arial, Helvetica"><b>MultiScrolling Database Sample</b></font><br>
</p>
<hr size="1" color="#000000">
<p>Contacts within the Authors Database:<br>
<br>
<%
   Dim oConn 
   Dim oRs  
   Dim filePath 
   Dim Mv  
   Dim PageNo 
   Dim j  
   Dim i 
   
   
   ' Map authors database to physical path
   
   filePath = Server.MapPath("authors.mdb")


   ' Create ADO Connection Component to connect with
   ' sample database 
   Set oConn = Server.CreateObject("ADODB.Connection")
   oConn.Open "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=" & filePath

   
   ' Create ADO Recordset Component
   
   Set oRs = Server.CreateObject("ADODB.Recordset")


   ' Determine what PageNumber the scrolling currently is on
   
   Mv = Request("Mv")

   If Request("PageNo") = "" Then
    PageNo = 1
   Else
    PageNo = Request("PageNo")
   End If
   
   
   ' Setup Query Recordset (4 records per page)
     
   oRs.Open "SELECT * FROM Authors", oConn, adOpenStatic
   oRs.PageSize = 4

   
   ' Adjust PageNumber as Appropriate
   
   If Mv = "Page Up" or Mv = "Page Down" Then
    Select Case Mv
     Case "Page Up"
      If PageNo > 1 Then
       PageNo = PageNo - 1
      Else
       PageNo = 1
      End If
     Case "Page Down"
      If oRs.AbsolutePage < oRs.PageCount Then
       PageNo = PageNo + 1
      Else
       PageNo = oRs.PageCount
      End If
     Case Else
      PageNo = 1
    End Select
   End If

   oRs.AbsolutePage = PageNo
  %>
<!-- Draw Table of Contacts in DB --></p>
<table BORDER="1">
  <%  For j = 1 to oRs.PageSize %>
  <tr>
    <%  For i = 0 to oRs.Fields.Count - 1 %>
    <td VALIGN="TOP"><%= oRs(i) %> </td>
    <%  Next %>
  </tr>
  <%
     oRs.MoveNext
     
     ' Don't try to print the EOF record.
     If oRs.EOF Then
      Exit For
     End If
    Next %>
</table>
<!-- Scrolling Navigation Control for Sample -->
<form Action="MultiScrolling_VBScript.asp" Method="POST">
  <input Type="Hidden" Name="PageNo" Value="<%= PageNo %>">
  <!-- Only show appropriate buttons --><%  If PageNo <  oRs.PageCount Then %>
  <p><input TYPE="Submit" Name="Mv" Value="Page Down"> <%  End If %>
  <%  If PageNo > 1 Then %> <input TYPE="Submit" Name="Mv" Value="Page Up">
  <%  End If %> </p>
</form>

</body>

</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值