<% @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>