home *** CD-ROM | disk | FTP | other *** search
- <% @LANGUAGE="JScript" %>
-
- <!--#include File="adojavas.inc"-->
-
- <HTML>
- <HEAD>
- <TITLE>MultiScrolling Database Sample</TITLE>
- </HEAD>
-
- <BODY BGCOLOR="White" topmargin="10" leftmargin="10">
-
-
- <!-- Display Header -->
-
- <font size="4" face="Arial, Helvetica">
- <b>MultiScrolling Database Sample</b></font><br>
-
- <hr size="1" color="#000000">
-
- Contacts within the Authors Database:<br><br>
-
-
- <%
- var oConn;
- var oRs;
- var curDir;
- var Mv;
- var PageNo;
- var j;
- var i;
-
-
- // Map authors database to physical path
-
- curDir = Server.MapPath("\\iissamples\\sdk\\asp\\database\\authors.mdb");
-
-
- // Create ADO Connection Component to connect with
- // sample database
-
- oConn = Server.CreateObject("ADODB.Connection");
- oConn.Open("DBQ="+curDir+";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;");
-
-
- // 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;
- }
- else
- {
- PageNo = Request("PageNo");
- }
-
-
- // Setup Query Recordset (4 records per page)
-
- oRs.Open ("SELECT * FROM Authors", oConn, adOpenStatic);
- oRs.PageSize = 4;
-
-
- // Adjust PageNumber as Appropriate
-
- if ((Mv == "PgUp") || (Mv == "PgDn"))
- {
- if (Mv == "PgUp")
- {
- if (PageNo > 1)
- {
- PageNo = PageNo - 1;
- }
- else
- {
- PageNo = 1;
- }
- }
- else if (Mv == "PgDn")
- {
- if (oRs.AbsolutePage < oRs.PageCount)
- {
- PageNo = PageNo + 1;
- }
- else
- {
- PageNo = oRs.PageCount;
- }
- }
- else
- {
- PageNo = 1;
- }
- }
-
- oRs.AbsolutePage = PageNo;
- %>
-
-
- <!-- Draw Table of Contacts in DB -->
-
- <TABLE BORDER=1>
- <% for (j = 0; j < oRs.PageSize; j++) { %>
- <TR>
- <% for (i = 0; i < oRs.Fields.Count; i++) { %>
- <TD VALIGN=TOP><%= oRs(i) %></TD>
- <% } %>
- </TR>
-
- <%
- oRs.MoveNext()
-
- // Don't try to print the EOF record.
- if (oRs.EOF) {
- break;
- }
- } %>
- </TABLE>
-
-
- <!-- Scrolling Navigation Control for Sample -->
-
- <Form Action=MultiScrolling_VBScript.asp Method="POST">
- <Input Type=Hidden Name= PageNo Value="<%= PageNo %>">
- <% if (PageNo > 1) {
- // Only show buttons that are appropriate %>
- <INPUT TYPE="Submit" Name="Mv" Value="PgUp">
- <% } %>
-
- <% if (PageNo < oRs.PageCount) {
- // Only show buttons that are appropriate %>
- <INPUT TYPE="Submit" Name="Mv" Value="PgDn">
- <% } %>
- </Form>
-
- </BODY>
- </HTML>
-