<% @LANGUAGE="VBSCRIPT" %> <% Option Explicit %> MultiScrolling Database Sample MultiScrolling Database Sample

Contacts within the Authors Database:

<% 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.4.0;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 %> <% For j = 1 to oRs.PageSize %> <% For i = 0 to oRs.Fields.Count - 1 %> <% Next %> <% oRs.MoveNext ' Don't try to print the EOF record. If oRs.EOF Then Exit For End If Next %>
<%= oRs(i) %>
<% If PageNo < oRs.PageCount Then %> <% End If %> <% If PageNo > 1 Then %> <% End If %>