<% @LANGUAGE="JScript" %> MultiScrolling Database Sample MultiScrolling Database Sample

Contacts within the Authors Database:

<% var oConn; var oRs; var filePath; var Mv; var PageNo; var j; var i; // Map authors database to physical path filePath = Server.MapPath("authors.mdb"); // Create ADO Connection Component to connect with // sample database oConn = Server.CreateObject("ADODB.Connection"); oConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +filePath); // Create ADO Recordset Component oRs = Server.CreateObject("ADODB.Recordset"); // Determine what PageNumber the scrolling currently is on Mv = Request("Mv"); PageNo = Request("PageNo"); if (!((PageNo > 0) || (PageNo < 999))) { PageNo = 1; } // 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") { if (PageNo > 1) { PageNo--; } else { PageNo = 1; } } else if (Mv == "Page Down") { if (oRs.AbsolutePage < oRs.PageCount) { PageNo++; } else { PageNo = oRs.PageCount; } } else { PageNo = 1; } oRs.AbsolutePage = PageNo; %> <% for (j = 0; j < oRs.PageSize; j++) { %> <% // Don't try to print the EOF record. if (oRs.EOF) { break; } %> <% for (i = 0; i < oRs.Fields.Count; i++) { %> <% } %> <% oRs.MoveNext() } %>
<%= oRs(i) %>
> <% if (PageNo < oRs.PageCount) { %> <% } %> <% if (PageNo > 1) { %> <% } %>
<% oRs.close(); oConn.close(); %>