Forums
This topic is locked
Multiple paged recordsets
27 Nov 2006 12:08:38 Jim Raff posted:
I need to display more than one set of paged records on the SAME page! The complete recordsets will be of different sizes - eg 121 records in one and 897 records in another. The DMX paging code places a repeating region of say 10 records for each recordset together with forward and back buttons BUT even if the code is modified for the second repeating region unique using say MMx_someParameter instead of MM_someParameter the forward and back buttons cause BOTH recordsets to page. I just want to page one or the other separately. Any ideas?
jimbuilder
Replies
Replied 05 Dec 2006 14:34:35
05 Dec 2006 14:34:35 Lee Diggins replied:
Hi Jim
This is quite easy, you can replace all variables and querystring name/value pairs with a new name. There's quite a lot to do though and so the possiblity of an error and the frustration level can be quite high.
I've completed one for you, just connect to the PUBS database to run this sample:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/PUBS.asp" -->
<%
Dim rsAuthors
Dim rsAuthors_numRows
Set rsAuthors = Server.CreateObject("ADODB.Recordset"
rsAuthors.ActiveConnection = MM_PUBS_STRING
rsAuthors.Source = "SELECT * FROM dbo.authors"
rsAuthors.CursorType = 0
rsAuthors.CursorLocation = 2
rsAuthors.LockType = 1
rsAuthors.Open()
rsAuthors_numRows = 0
%>
<%
Dim rsPublications
Dim rsPublications_numRows
Set rsPublications = Server.CreateObject("ADODB.Recordset"
rsPublications.ActiveConnection = MM_PUBS_STRING
rsPublications.Source = "SELECT * FROM dbo.titles"
rsPublications.CursorType = 0
rsPublications.CursorLocation = 2
rsPublications.LockType = 1
rsPublications.Open()
rsPublications_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = 5
Repeat1__index = 0
rsAuthors_numRows = rsAuthors_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index
Repeat2__numRows = 5
Repeat2__index = 0
rsPublications_numRows = rsPublications_numRows + Repeat2__numRows
%>
<%
' ALL CODE THAT FOLLOWS IS THE PAGING CODE TABLE 1
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim rsAuthors_total
Dim rsAuthors_first
Dim rsAuthors_last
' set the record count
rsAuthors_total = rsAuthors.RecordCount
' set the number of rows displayed on this page
If (rsAuthors_numRows < 0) Then
rsAuthors_numRows = rsAuthors_total
Elseif (rsAuthors_numRows = 0) Then
rsAuthors_numRows = 1
End If
' set the first and last displayed record
rsAuthors_first = 1
rsAuthors_last = rsAuthors_first + rsAuthors_numRows - 1
' if we have the correct record count, check the other stats
If (rsAuthors_total <> -1) Then
If (rsAuthors_first > rsAuthors_total) Then
rsAuthors_first = rsAuthors_total
End If
If (rsAuthors_last > rsAuthors_total) Then
rsAuthors_last = rsAuthors_total
End If
If (rsAuthors_numRows > rsAuthors_total) Then
rsAuthors_numRows = rsAuthors_total
End If
End If
%>
<%
Dim MM_paramName__1
%>
<%
' *** Move To Record and Go To Record: declare variables
Dim MM_rs__1
Dim MM_rsCount__1
Dim MM_size__1
Dim MM_uniqueCol__1
Dim MM_offset__1
Dim MM_atTotal__1
Dim MM_paramIsDefined__1
Dim MM_param__1
Dim MM_index__1
Set MM_rs__1 = rsAuthors
MM_rsCount__1 = rsAuthors_total
MM_size__1 = rsAuthors_numRows
MM_uniqueCol__1 = ""
MM_paramName__1 = ""
MM_offset__1 = 0
MM_atTotal__1 = false
MM_paramIsDefined__1 = false
If (MM_paramName__1 <> "" Then
MM_paramIsDefined__1 = (Request.QueryString(MM_paramName__1) <> ""
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter
if (Not MM_paramIsDefined__1 And MM_rsCount__1 <> 0) then
' use index parameter if defined, otherwise use offset parameter
MM_param__1 = Request.QueryString("index__1"
If (MM_param__1 = "" Then
MM_param__1 = Request.QueryString("offset__1"
End If
If (MM_param__1 <> "" Then
MM_offset__1 = Int(MM_param__1)
End If
' if we have a record count, check if we are past the end of the recordset
If (MM_rsCount__1 <> -1) Then
If (MM_offset__1 >= MM_rsCount__1 Or MM_offset__1 = -1) Then ' past end or move last
If ((MM_rsCount__1 Mod MM_size__1) > 0) Then ' last page not a full repeat region
MM_offset__1 = MM_rsCount__1 - (MM_rsCount__1 Mod MM_size__1)
Else
MM_offset__1 = MM_rsCount__1 - MM_size__1
End If
End If
End If
' move the cursor to the selected record
MM_index__1 = 0
While ((Not MM_rs__1.EOF) And (MM_index__1 < MM_offset__1 Or MM_offset__1 = -1))
MM_rs__1.MoveNext
MM_index__1 = MM_index__1 + 1
Wend
If (MM_rs__1.EOF) Then
MM_offset__1 = MM_index__1 ' set MM_offset__1 to the last possible record
End If
End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range
If (MM_rsCount__1 = -1) Then
' walk to the end of the display range for this page
MM_index__1 = MM_offset__1
While (Not MM_rs__1.EOF And (MM_size__1 < 0 Or MM_index__1 < MM_offset__1 + MM_size__1))
MM_rs__1.MoveNext
MM_index__1 = MM_index__1 + 1
Wend
' if we walked off the end of the recordset, set MM_rsCount__1 and MM_size__1
If (MM_rs__1.EOF) Then
MM_rsCount__1 = MM_index__1
If (MM_size__1 < 0 Or MM_size__1 > MM_rsCount__1) Then
MM_size__1 = MM_rsCount__1
End If
End If
' if we walked off the end, set the offset based on page size
If (MM_rs__1.EOF And Not MM_paramIsDefined__1) Then
If (MM_offset__1 > MM_rsCount__1 - MM_size__1 Or MM_offset__1 = -1) Then
If ((MM_rsCount__1 Mod MM_size__1) > 0) Then
MM_offset__1 = MM_rsCount__1 - (MM_rsCount__1 Mod MM_size__1)
Else
MM_offset__1 = MM_rsCount__1 - MM_size__1
End If
End If
End If
' reset the cursor to the beginning
If (MM_rs__1.CursorType > 0) Then
MM_rs__1.MoveFirst
Else
MM_rs__1.Requery
End If
' move the cursor to the selected record
MM_index__1 = 0
While (Not MM_rs__1.EOF And MM_index__1 < MM_offset__1)
MM_rs__1.MoveNext
MM_index__1 = MM_index__1 + 1
Wend
End If
%>
<%
' *** Move To Record: update recordset stats
' set the first and last displayed record
rsAuthors_first = MM_offset__1 + 1
rsAuthors_last = MM_offset__1 + MM_size__1
If (MM_rsCount__1 <> -1) Then
If (rsAuthors_first > MM_rsCount__1) Then
rsAuthors_first = MM_rsCount__1
End If
If (rsAuthors_last > MM_rsCount__1) Then
rsAuthors_last = MM_rsCount__1
End If
End If
' set the boolean used by hide region to check if we are on the last record
MM_atTotal__1 = (MM_rsCount__1 <> -1 And MM_offset__1 + MM_size__1 >= MM_rsCount__1)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
Dim MM_keepNone__1
Dim MM_keepURL__1
Dim MM_keepForm__1
Dim MM_keepBoth__1
Dim MM_removeList__1
Dim MM_item__1
Dim MM_nextItem__1
' create the list of parameters which should not be maintained
MM_removeList__1 = "&index__1="
If (MM_paramName__1 <> "" Then
MM_removeList__1 = MM_removeList__1 & "&" & MM_paramName__1 & "="
End If
MM_keepURL__1=""
MM_keepForm__1=""
MM_keepBoth__1=""
MM_keepNone__1=""
' add the URL parameters to the MM_keepURL__1 string
For Each MM_item__1 In Request.QueryString
MM_nextItem__1 = "&" & MM_item__1 & "="
If (InStr(1,MM_removeList__1,MM_nextItem__1,1) = 0) Then
MM_keepURL__1 = MM_keepURL__1 & MM_nextItem__1 & Server.URLencode(Request.QueryString(MM_item__1))
End If
Next
' add the Form variables to the MM_keepForm__1 string
For Each MM_item__1 In Request.Form
MM_nextItem__1 = "&" & MM_item__1 & "="
If (InStr(1,MM_removeList__1,MM_nextItem__1,1) = 0) Then
MM_keepForm__1 = MM_keepForm__1 & MM_nextItem__1 & Server.URLencode(Request.Form(MM_item__1))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth__1 = MM_keepURL__1 & MM_keepForm__1
If (MM_keepBoth__1 <> "" Then
MM_keepBoth__1 = Right(MM_keepBoth__1, Len(MM_keepBoth__1) - 1)
End If
If (MM_keepURL__1 <> "" Then
MM_keepURL__1 = Right(MM_keepURL__1, Len(MM_keepURL__1) - 1)
End If
If (MM_keepForm__1 <> "" Then
MM_keepForm__1 = Right(MM_keepForm__1, Len(MM_keepForm__1) - 1)
End If
' a utility function used for adding additional parameters to these strings
Function MM_joinChar__1(firstItem__1)
If (firstItem__1 <> "" Then
MM_joinChar__1 = "&"
Else
MM_joinChar__1 = ""
End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links
Dim MM_keepMove__1
Dim MM_moveParam__1
Dim MM_moveFirst__1
Dim MM_moveLast__1
Dim MM_moveNext__1
Dim MM_movePrev__1
Dim MM_urlStr__1
Dim MM_paramList__1
Dim MM_paramIndex__1
Dim MM_nextParam__1
MM_keepMove__1 = MM_keepBoth__1
MM_moveParam__1 = "index__1"
' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size__1 > 1) Then
MM_moveParam__1 = "offset__1"
If (MM_keepMove__1 <> "" Then
MM_paramList__1 = Split(MM_keepMove__1, "&"
MM_keepMove__1 = ""
For MM_paramIndex__1 = 0 To UBound(MM_paramList__1)
MM_nextParam__1 = Left(MM_paramList__1(MM_paramIndex__1), InStr(MM_paramList__1(MM_paramIndex__1),"=" - 1)
If (StrComp(MM_nextParam__1,MM_moveParam__1,1) <> 0) Then
MM_keepMove__1 = MM_keepMove__1 & "&" & MM_paramList__1(MM_paramIndex__1)
End If
Next
If (MM_keepMove__1 <> "" Then
MM_keepMove__1 = Right(MM_keepMove__1, Len(MM_keepMove__1) - 1)
End If
End If
End If
' set the strings for the move to links
If (MM_keepMove__1 <> "" Then
MM_keepMove__1 = Server.HTMLEncode(MM_keepMove__1) & "&"
End If
MM_urlStr__1 = Request.ServerVariables("URL" & "?" & MM_keepMove__1 & MM_moveParam__1 & "="
MM_moveFirst__1 = MM_urlStr__1 & "0"
MM_moveLast__1 = MM_urlStr__1 & "-1"
MM_moveNext__1 = MM_urlStr__1 & CStr(MM_offset__1 + MM_size__1)
If (MM_offset__1 - MM_size__1 < 0) Then
MM_movePrev__1 = MM_urlStr__1 & "0"
Else
MM_movePrev__1 = MM_urlStr__1 & CStr(MM_offset__1 - MM_size__1)
End If
%>
<%
' ALL CODE THAT FOLLOWS IS THE PAGING CODE TABLE 2
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim rsPublications_total
Dim rsPublications_first
Dim rsPublications_last
' set the record count
rsPublications_total = rsPublications.RecordCount
' set the number of rows displayed on this page
If (rsPublications_numRows < 0) Then
rsPublications_numRows = rsPublications_total
Elseif (rsPublications_numRows = 0) Then
rsPublications_numRows = 1
End If
' set the first and last displayed record
rsPublications_first = 1
rsPublications_last = rsPublications_first + rsPublications_numRows - 1
' if we have the correct record count, check the other stats
If (rsPublications_total <> -1) Then
If (rsPublications_first > rsPublications_total) Then
rsPublications_first = rsPublications_total
End If
If (rsPublications_last > rsPublications_total) Then
rsPublications_last = rsPublications_total
End If
If (rsPublications_numRows > rsPublications_total) Then
rsPublications_numRows = rsPublications_total
End If
End If
%>
<%
Dim MM_paramName__2
%>
<%
' *** Move To Record and Go To Record: declare variables
Dim MM_rs__2
Dim MM_rsCount__2
Dim MM_size__2
Dim MM_uniqueCol__2
Dim MM_offset__2
Dim MM_atTotal__2
Dim MM_paramIsDefined__2
Dim MM_param__2
Dim MM_index__2
Set MM_rs__2 = rsPublications
MM_rsCount__2 = rsPublications_total
MM_size__2 = rsPublications_numRows
MM_uniqueCol__2 = ""
MM_paramName__2 = ""
MM_offset__2 = 0
MM_atTotal__2 = false
MM_paramIsDefined__2 = false
If (MM_paramName__2 <> "" Then
MM_paramIsDefined__2 = (Request.QueryString(MM_paramName__2) <> ""
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter
if (Not MM_paramIsDefined__2 And MM_rsCount__2 <> 0) then
' use index parameter if defined, otherwise use offset parameter
MM_param__2 = Request.QueryString("index__2"
If (MM_param__2 = "" Then
MM_param__2 = Request.QueryString("offset__2"
End If
If (MM_param__2 <> "" Then
MM_offset__2 = Int(MM_param__2)
End If
' if we have a record count, check if we are past the end of the recordset
If (MM_rsCount__2 <> -1) Then
If (MM_offset__2 >= MM_rsCount__2 Or MM_offset__2 = -1) Then ' past end or move last
If ((MM_rsCount__2 Mod MM_size__2) > 0) Then ' last page not a full repeat region
MM_offset__2 = MM_rsCount__2 - (MM_rsCount__2 Mod MM_size__2)
Else
MM_offset__2 = MM_rsCount__2 - MM_size__2
End If
End If
End If
' move the cursor to the selected record
MM_index__2 = 0
While ((Not MM_rs__2.EOF) And (MM_index__2 < MM_offset__2 Or MM_offset__2 = -1))
MM_rs__2.MoveNext
MM_index__2 = MM_index__2 + 1
Wend
If (MM_rs__2.EOF) Then
MM_offset__2 = MM_index__2 ' set MM_offset__2 to the last possible record
End If
End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range
If (MM_rsCount__2 = -1) Then
' walk to the end of the display range for this page
MM_index__2 = MM_offset__2
While (Not MM_rs__2.EOF And (MM_size__2 < 0 Or MM_index__2 < MM_offset__2 + MM_size__2))
MM_rs__2.MoveNext
MM_index__2 = MM_index__2 + 1
Wend
' if we walked off the end of the recordset, set MM_rsCount__2 and MM_size__2
If (MM_rs__2.EOF) Then
MM_rsCount__2 = MM_index__2
If (MM_size__2 < 0 Or MM_size__2 > MM_rsCount__2) Then
MM_size__2 = MM_rsCount__2
End If
End If
' if we walked off the end, set the offset based on page size
If (MM_rs__2.EOF And Not MM_paramIsDefined__2) Then
If (MM_offset__2 > MM_rsCount__2 - MM_size__2 Or MM_offset__2 = -1) Then
If ((MM_rsCount__2 Mod MM_size__2) > 0) Then
MM_offset__2 = MM_rsCount__2 - (MM_rsCount__2 Mod MM_size__2)
Else
MM_offset__2 = MM_rsCount__2 - MM_size__2
End If
End If
End If
' reset the cursor to the beginning
If (MM_rs__2.CursorType > 0) Then
MM_rs__2.MoveFirst
Else
MM_rs__2.Requery
End If
' move the cursor to the selected record
MM_index__2 = 0
While (Not MM_rs__2.EOF And MM_index__2 < MM_offset__2)
MM_rs__2.MoveNext
MM_index__2 = MM_index__2 + 1
Wend
End If
%>
<%
' *** Move To Record: update recordset stats
' set the first and last displayed record
rsPublications_first = MM_offset__2 + 1
rsPublications_last = MM_offset__2 + MM_size__2
If (MM_rsCount__2 <> -1) Then
If (rsPublications_first > MM_rsCount__2) Then
rsPublications_first = MM_rsCount__2
End If
If (rsPublications_last > MM_rsCount__2) Then
rsPublications_last = MM_rsCount__2
End If
End If
' set the boolean used by hide region to check if we are on the last record
MM_atTotal__2 = (MM_rsCount__2 <> -1 And MM_offset__2 + MM_size__2 >= MM_rsCount__2)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
Dim MM_keepNone__2
Dim MM_keepURL__2
Dim MM_keepForm__2
Dim MM_keepBoth__2
Dim MM_removeList__2
Dim MM_item__2
Dim MM_nextItem__2
' create the list of parameters which should not be maintained
MM_removeList__2 = "&index__2="
If (MM_paramName__2 <> "" Then
MM_removeList__2 = MM_removeList__2 & "&" & MM_paramName__2 & "="
End If
MM_keepURL__2=""
MM_keepForm__2=""
MM_keepBoth__2=""
MM_keepNone__2=""
' add the URL parameters to the MM_keepURL__2 string
For Each MM_item__2 In Request.QueryString
MM_nextItem__2 = "&" & MM_item__2 & "="
If (InStr(1,MM_removeList__2,MM_nextItem__2,1) = 0) Then
MM_keepURL__2 = MM_keepURL__2 & MM_nextItem__2 & Server.URLencode(Request.QueryString(MM_item__2))
End If
Next
' add the Form variables to the MM_keepForm__2 string
For Each MM_item__2 In Request.Form
MM_nextItem__2 = "&" & MM_item__2 & "="
If (InStr(1,MM_removeList__2,MM_nextItem__2,1) = 0) Then
MM_keepForm__2 = MM_keepForm__2 & MM_nextItem__2 & Server.URLencode(Request.Form(MM_item__2))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth__2 = MM_keepURL__2 & MM_keepForm__2
If (MM_keepBoth__2 <> "" Then
MM_keepBoth__2 = Right(MM_keepBoth__2, Len(MM_keepBoth__2) - 1)
End If
If (MM_keepURL__2 <> "" Then
MM_keepURL__2 = Right(MM_keepURL__2, Len(MM_keepURL__2) - 1)
End If
If (MM_keepForm__2 <> "" Then
MM_keepForm__2 = Right(MM_keepForm__2, Len(MM_keepForm__2) - 1)
End If
' a utility function used for adding additional parameters to these strings
Function MM_joinChar__2(firstItem__2)
If (firstItem__2 <> "" Then
MM_joinChar__2 = "&"
Else
MM_joinChar__2 = ""
End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links
Dim MM_keepMove__2
Dim MM_moveParam__2
Dim MM_moveFirst__2
Dim MM_moveLast__2
Dim MM_moveNext__2
Dim MM_movePrev__2
Dim MM_urlStr__2
Dim MM_paramList__2
Dim MM_paramIndex__2
Dim MM_nextParam__2
MM_keepMove__2 = MM_keepBoth__2
MM_moveParam__2 = "index__2"
' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size__2 > 1) Then
MM_moveParam__2 = "offset__2"
If (MM_keepMove__2 <> "" Then
MM_paramList__2 = Split(MM_keepMove__2, "&"
MM_keepMove__2 = ""
For MM_paramIndex__2 = 0 To UBound(MM_paramList__2)
MM_nextParam__2 = Left(MM_paramList__2(MM_paramIndex__2), InStr(MM_paramList__2(MM_paramIndex__2),"=" - 1)
If (StrComp(MM_nextParam__2,MM_moveParam__2,1) <> 0) Then
MM_keepMove__2 = MM_keepMove__2 & "&" & MM_paramList__2(MM_paramIndex__2)
End If
Next
If (MM_keepMove__2 <> "" Then
MM_keepMove__2 = Right(MM_keepMove__2, Len(MM_keepMove__2) - 1)
End If
End If
End If
' set the strings for the move to links
If (MM_keepMove__2 <> "" Then
MM_keepMove__2 = Server.HTMLEncode(MM_keepMove__2) & "&"
End If
MM_urlStr__2 = Request.ServerVariables("URL" & "?" & MM_keepMove__2 & MM_moveParam__2 & "="
MM_moveFirst__2 = MM_urlStr__2 & "0"
MM_moveLast__2 = MM_urlStr__2 & "-1"
MM_moveNext__2 = MM_urlStr__2 & CStr(MM_offset__2 + MM_size__2)
If (MM_offset__2 - MM_size__2 < 0) Then
MM_movePrev__2 = MM_urlStr__2 & "0"
Else
MM_movePrev__2 = MM_urlStr__2 & CStr(MM_offset__2 - MM_size__2)
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>
<body>
<p>PUBS Database
</p>
<hr>
<p>Authors</p>
<hr>
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center"><% If MM_offset__1 <> 0 Then %>
<a href="<%=MM_moveFirst__1%>">First</a>
<% End If ' end MM_offset <> 0 %>
</td>
<td width="31%" align="center"><% If MM_offset__1 <> 0 Then %>
<a href="<%=MM_movePrev__1%>">Previous</a>
<% End If ' end MM_offset <> 0 %>
</td>
<td width="23%" align="center"><% If Not MM_atTotal__1 Then %>
<a href="<%=MM_moveNext__1%>">Next</a>
<% End If ' end Not MM_atTotal %>
</td>
<td width="23%" align="center"><% If Not MM_atTotal__1 Then %>
<a href="<%=MM_moveLast__1%>">Last</a>
<% End If ' end Not MM_atTotal %>
</td>
</tr>
</table>
<table border="0" cellpadding="3" cellspacing="0">
<tr>
<td>au_id</td>
<td>au_lname</td>
<td>au_fname</td>
<td>phone</td>
<td>address</td>
<td>city</td>
<td>state</td>
<td>zip</td>
<td>contract</td>
</tr>
<% While ((Repeat1__numRows <> 0) AND (NOT rsAuthors.EOF)) %>
<tr>
<td><%=(rsAuthors.Fields.Item("au_id".Value)%></td>
<td><%=(rsAuthors.Fields.Item("au_lname".Value)%></td>
<td><%=(rsAuthors.Fields.Item("au_fname".Value)%></td>
<td><%=(rsAuthors.Fields.Item("phone".Value)%></td>
<td><%=(rsAuthors.Fields.Item("address".Value)%></td>
<td><%=(rsAuthors.Fields.Item("city".Value)%></td>
<td><%=(rsAuthors.Fields.Item("state".Value)%></td>
<td><%=(rsAuthors.Fields.Item("zip".Value)%></td>
<td><%=(rsAuthors.Fields.Item("contract".Value)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsAuthors.MoveNext()
Wend
%>
</table>
<hr>
<p>Publications</p>
<hr>
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center"><% If MM_offset__2 <> 0 Then %>
<a href="<%=MM_moveFirst__2%>">First</a>
<% End If ' end MM_offset <> 0 %>
</td>
<td width="31%" align="center"><% If MM_offset__2 <> 0 Then %>
<a href="<%=MM_movePrev__2%>">Previous</a>
<% End If ' end MM_offset <> 0 %>
</td>
<td width="23%" align="center"><% If Not MM_atTotal__2 Then %>
<a href="<%=MM_moveNext__2%>">Next</a>
<% End If ' end Not MM_atTotal %>
</td>
<td width="23%" align="center"><% If Not MM_atTotal__2 Then %>
<a href="<%=MM_moveLast__2%>">Last</a>
<% End If ' end Not MM_atTotal %>
</td>
</tr>
</table>
<table border="0" cellpadding="3" cellspacing="0">
<tr>
<td>title_id</td>
<td>title</td>
<td>type</td>
<td>pub_id</td>
<td>price</td>
<td>advance</td>
<td>royalty</td>
<td>ytd_sales</td>
<td>notes</td>
<td>pubdate</td>
</tr>
<% While ((Repeat2__numRows <> 0) AND (NOT rsPublications.EOF)) %>
<tr>
<td><%=(rsPublications.Fields.Item("title_id".Value)%></td>
<td><%=(rsPublications.Fields.Item("title".Value)%></td>
<td><%=(rsPublications.Fields.Item("type".Value)%></td>
<td><%=(rsPublications.Fields.Item("pub_id".Value)%></td>
<td><%=(rsPublications.Fields.Item("price".Value)%></td>
<td><%=(rsPublications.Fields.Item("advance".Value)%></td>
<td><%=(rsPublications.Fields.Item("royalty".Value)%></td>
<td><%=(rsPublications.Fields.Item("ytd_sales".Value)%></td>
<td><%=(rsPublications.Fields.Item("notes".Value)%></td>
<td><%=(rsPublications.Fields.Item("pubdate".Value)%></td>
</tr>
<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
rsPublications.MoveNext()
Wend
%>
</table>
<hr>
</body>
</html>
<%
rsAuthors.Close()
Set rsAuthors = Nothing
%>
<%
rsPublications.Close()
Set rsPublications = Nothing
%>
Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS ]</font>
This is quite easy, you can replace all variables and querystring name/value pairs with a new name. There's quite a lot to do though and so the possiblity of an error and the frustration level can be quite high.
I've completed one for you, just connect to the PUBS database to run this sample:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/PUBS.asp" -->
<%
Dim rsAuthors
Dim rsAuthors_numRows
Set rsAuthors = Server.CreateObject("ADODB.Recordset"
rsAuthors.ActiveConnection = MM_PUBS_STRING
rsAuthors.Source = "SELECT * FROM dbo.authors"
rsAuthors.CursorType = 0
rsAuthors.CursorLocation = 2
rsAuthors.LockType = 1
rsAuthors.Open()
rsAuthors_numRows = 0
%>
<%
Dim rsPublications
Dim rsPublications_numRows
Set rsPublications = Server.CreateObject("ADODB.Recordset"
rsPublications.ActiveConnection = MM_PUBS_STRING
rsPublications.Source = "SELECT * FROM dbo.titles"
rsPublications.CursorType = 0
rsPublications.CursorLocation = 2
rsPublications.LockType = 1
rsPublications.Open()
rsPublications_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = 5
Repeat1__index = 0
rsAuthors_numRows = rsAuthors_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index
Repeat2__numRows = 5
Repeat2__index = 0
rsPublications_numRows = rsPublications_numRows + Repeat2__numRows
%>
<%
' ALL CODE THAT FOLLOWS IS THE PAGING CODE TABLE 1
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim rsAuthors_total
Dim rsAuthors_first
Dim rsAuthors_last
' set the record count
rsAuthors_total = rsAuthors.RecordCount
' set the number of rows displayed on this page
If (rsAuthors_numRows < 0) Then
rsAuthors_numRows = rsAuthors_total
Elseif (rsAuthors_numRows = 0) Then
rsAuthors_numRows = 1
End If
' set the first and last displayed record
rsAuthors_first = 1
rsAuthors_last = rsAuthors_first + rsAuthors_numRows - 1
' if we have the correct record count, check the other stats
If (rsAuthors_total <> -1) Then
If (rsAuthors_first > rsAuthors_total) Then
rsAuthors_first = rsAuthors_total
End If
If (rsAuthors_last > rsAuthors_total) Then
rsAuthors_last = rsAuthors_total
End If
If (rsAuthors_numRows > rsAuthors_total) Then
rsAuthors_numRows = rsAuthors_total
End If
End If
%>
<%
Dim MM_paramName__1
%>
<%
' *** Move To Record and Go To Record: declare variables
Dim MM_rs__1
Dim MM_rsCount__1
Dim MM_size__1
Dim MM_uniqueCol__1
Dim MM_offset__1
Dim MM_atTotal__1
Dim MM_paramIsDefined__1
Dim MM_param__1
Dim MM_index__1
Set MM_rs__1 = rsAuthors
MM_rsCount__1 = rsAuthors_total
MM_size__1 = rsAuthors_numRows
MM_uniqueCol__1 = ""
MM_paramName__1 = ""
MM_offset__1 = 0
MM_atTotal__1 = false
MM_paramIsDefined__1 = false
If (MM_paramName__1 <> "" Then
MM_paramIsDefined__1 = (Request.QueryString(MM_paramName__1) <> ""
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter
if (Not MM_paramIsDefined__1 And MM_rsCount__1 <> 0) then
' use index parameter if defined, otherwise use offset parameter
MM_param__1 = Request.QueryString("index__1"
If (MM_param__1 = "" Then
MM_param__1 = Request.QueryString("offset__1"
End If
If (MM_param__1 <> "" Then
MM_offset__1 = Int(MM_param__1)
End If
' if we have a record count, check if we are past the end of the recordset
If (MM_rsCount__1 <> -1) Then
If (MM_offset__1 >= MM_rsCount__1 Or MM_offset__1 = -1) Then ' past end or move last
If ((MM_rsCount__1 Mod MM_size__1) > 0) Then ' last page not a full repeat region
MM_offset__1 = MM_rsCount__1 - (MM_rsCount__1 Mod MM_size__1)
Else
MM_offset__1 = MM_rsCount__1 - MM_size__1
End If
End If
End If
' move the cursor to the selected record
MM_index__1 = 0
While ((Not MM_rs__1.EOF) And (MM_index__1 < MM_offset__1 Or MM_offset__1 = -1))
MM_rs__1.MoveNext
MM_index__1 = MM_index__1 + 1
Wend
If (MM_rs__1.EOF) Then
MM_offset__1 = MM_index__1 ' set MM_offset__1 to the last possible record
End If
End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range
If (MM_rsCount__1 = -1) Then
' walk to the end of the display range for this page
MM_index__1 = MM_offset__1
While (Not MM_rs__1.EOF And (MM_size__1 < 0 Or MM_index__1 < MM_offset__1 + MM_size__1))
MM_rs__1.MoveNext
MM_index__1 = MM_index__1 + 1
Wend
' if we walked off the end of the recordset, set MM_rsCount__1 and MM_size__1
If (MM_rs__1.EOF) Then
MM_rsCount__1 = MM_index__1
If (MM_size__1 < 0 Or MM_size__1 > MM_rsCount__1) Then
MM_size__1 = MM_rsCount__1
End If
End If
' if we walked off the end, set the offset based on page size
If (MM_rs__1.EOF And Not MM_paramIsDefined__1) Then
If (MM_offset__1 > MM_rsCount__1 - MM_size__1 Or MM_offset__1 = -1) Then
If ((MM_rsCount__1 Mod MM_size__1) > 0) Then
MM_offset__1 = MM_rsCount__1 - (MM_rsCount__1 Mod MM_size__1)
Else
MM_offset__1 = MM_rsCount__1 - MM_size__1
End If
End If
End If
' reset the cursor to the beginning
If (MM_rs__1.CursorType > 0) Then
MM_rs__1.MoveFirst
Else
MM_rs__1.Requery
End If
' move the cursor to the selected record
MM_index__1 = 0
While (Not MM_rs__1.EOF And MM_index__1 < MM_offset__1)
MM_rs__1.MoveNext
MM_index__1 = MM_index__1 + 1
Wend
End If
%>
<%
' *** Move To Record: update recordset stats
' set the first and last displayed record
rsAuthors_first = MM_offset__1 + 1
rsAuthors_last = MM_offset__1 + MM_size__1
If (MM_rsCount__1 <> -1) Then
If (rsAuthors_first > MM_rsCount__1) Then
rsAuthors_first = MM_rsCount__1
End If
If (rsAuthors_last > MM_rsCount__1) Then
rsAuthors_last = MM_rsCount__1
End If
End If
' set the boolean used by hide region to check if we are on the last record
MM_atTotal__1 = (MM_rsCount__1 <> -1 And MM_offset__1 + MM_size__1 >= MM_rsCount__1)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
Dim MM_keepNone__1
Dim MM_keepURL__1
Dim MM_keepForm__1
Dim MM_keepBoth__1
Dim MM_removeList__1
Dim MM_item__1
Dim MM_nextItem__1
' create the list of parameters which should not be maintained
MM_removeList__1 = "&index__1="
If (MM_paramName__1 <> "" Then
MM_removeList__1 = MM_removeList__1 & "&" & MM_paramName__1 & "="
End If
MM_keepURL__1=""
MM_keepForm__1=""
MM_keepBoth__1=""
MM_keepNone__1=""
' add the URL parameters to the MM_keepURL__1 string
For Each MM_item__1 In Request.QueryString
MM_nextItem__1 = "&" & MM_item__1 & "="
If (InStr(1,MM_removeList__1,MM_nextItem__1,1) = 0) Then
MM_keepURL__1 = MM_keepURL__1 & MM_nextItem__1 & Server.URLencode(Request.QueryString(MM_item__1))
End If
Next
' add the Form variables to the MM_keepForm__1 string
For Each MM_item__1 In Request.Form
MM_nextItem__1 = "&" & MM_item__1 & "="
If (InStr(1,MM_removeList__1,MM_nextItem__1,1) = 0) Then
MM_keepForm__1 = MM_keepForm__1 & MM_nextItem__1 & Server.URLencode(Request.Form(MM_item__1))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth__1 = MM_keepURL__1 & MM_keepForm__1
If (MM_keepBoth__1 <> "" Then
MM_keepBoth__1 = Right(MM_keepBoth__1, Len(MM_keepBoth__1) - 1)
End If
If (MM_keepURL__1 <> "" Then
MM_keepURL__1 = Right(MM_keepURL__1, Len(MM_keepURL__1) - 1)
End If
If (MM_keepForm__1 <> "" Then
MM_keepForm__1 = Right(MM_keepForm__1, Len(MM_keepForm__1) - 1)
End If
' a utility function used for adding additional parameters to these strings
Function MM_joinChar__1(firstItem__1)
If (firstItem__1 <> "" Then
MM_joinChar__1 = "&"
Else
MM_joinChar__1 = ""
End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links
Dim MM_keepMove__1
Dim MM_moveParam__1
Dim MM_moveFirst__1
Dim MM_moveLast__1
Dim MM_moveNext__1
Dim MM_movePrev__1
Dim MM_urlStr__1
Dim MM_paramList__1
Dim MM_paramIndex__1
Dim MM_nextParam__1
MM_keepMove__1 = MM_keepBoth__1
MM_moveParam__1 = "index__1"
' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size__1 > 1) Then
MM_moveParam__1 = "offset__1"
If (MM_keepMove__1 <> "" Then
MM_paramList__1 = Split(MM_keepMove__1, "&"
MM_keepMove__1 = ""
For MM_paramIndex__1 = 0 To UBound(MM_paramList__1)
MM_nextParam__1 = Left(MM_paramList__1(MM_paramIndex__1), InStr(MM_paramList__1(MM_paramIndex__1),"=" - 1)
If (StrComp(MM_nextParam__1,MM_moveParam__1,1) <> 0) Then
MM_keepMove__1 = MM_keepMove__1 & "&" & MM_paramList__1(MM_paramIndex__1)
End If
Next
If (MM_keepMove__1 <> "" Then
MM_keepMove__1 = Right(MM_keepMove__1, Len(MM_keepMove__1) - 1)
End If
End If
End If
' set the strings for the move to links
If (MM_keepMove__1 <> "" Then
MM_keepMove__1 = Server.HTMLEncode(MM_keepMove__1) & "&"
End If
MM_urlStr__1 = Request.ServerVariables("URL" & "?" & MM_keepMove__1 & MM_moveParam__1 & "="
MM_moveFirst__1 = MM_urlStr__1 & "0"
MM_moveLast__1 = MM_urlStr__1 & "-1"
MM_moveNext__1 = MM_urlStr__1 & CStr(MM_offset__1 + MM_size__1)
If (MM_offset__1 - MM_size__1 < 0) Then
MM_movePrev__1 = MM_urlStr__1 & "0"
Else
MM_movePrev__1 = MM_urlStr__1 & CStr(MM_offset__1 - MM_size__1)
End If
%>
<%
' ALL CODE THAT FOLLOWS IS THE PAGING CODE TABLE 2
%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim rsPublications_total
Dim rsPublications_first
Dim rsPublications_last
' set the record count
rsPublications_total = rsPublications.RecordCount
' set the number of rows displayed on this page
If (rsPublications_numRows < 0) Then
rsPublications_numRows = rsPublications_total
Elseif (rsPublications_numRows = 0) Then
rsPublications_numRows = 1
End If
' set the first and last displayed record
rsPublications_first = 1
rsPublications_last = rsPublications_first + rsPublications_numRows - 1
' if we have the correct record count, check the other stats
If (rsPublications_total <> -1) Then
If (rsPublications_first > rsPublications_total) Then
rsPublications_first = rsPublications_total
End If
If (rsPublications_last > rsPublications_total) Then
rsPublications_last = rsPublications_total
End If
If (rsPublications_numRows > rsPublications_total) Then
rsPublications_numRows = rsPublications_total
End If
End If
%>
<%
Dim MM_paramName__2
%>
<%
' *** Move To Record and Go To Record: declare variables
Dim MM_rs__2
Dim MM_rsCount__2
Dim MM_size__2
Dim MM_uniqueCol__2
Dim MM_offset__2
Dim MM_atTotal__2
Dim MM_paramIsDefined__2
Dim MM_param__2
Dim MM_index__2
Set MM_rs__2 = rsPublications
MM_rsCount__2 = rsPublications_total
MM_size__2 = rsPublications_numRows
MM_uniqueCol__2 = ""
MM_paramName__2 = ""
MM_offset__2 = 0
MM_atTotal__2 = false
MM_paramIsDefined__2 = false
If (MM_paramName__2 <> "" Then
MM_paramIsDefined__2 = (Request.QueryString(MM_paramName__2) <> ""
End If
%>
<%
' *** Move To Record: handle 'index' or 'offset' parameter
if (Not MM_paramIsDefined__2 And MM_rsCount__2 <> 0) then
' use index parameter if defined, otherwise use offset parameter
MM_param__2 = Request.QueryString("index__2"
If (MM_param__2 = "" Then
MM_param__2 = Request.QueryString("offset__2"
End If
If (MM_param__2 <> "" Then
MM_offset__2 = Int(MM_param__2)
End If
' if we have a record count, check if we are past the end of the recordset
If (MM_rsCount__2 <> -1) Then
If (MM_offset__2 >= MM_rsCount__2 Or MM_offset__2 = -1) Then ' past end or move last
If ((MM_rsCount__2 Mod MM_size__2) > 0) Then ' last page not a full repeat region
MM_offset__2 = MM_rsCount__2 - (MM_rsCount__2 Mod MM_size__2)
Else
MM_offset__2 = MM_rsCount__2 - MM_size__2
End If
End If
End If
' move the cursor to the selected record
MM_index__2 = 0
While ((Not MM_rs__2.EOF) And (MM_index__2 < MM_offset__2 Or MM_offset__2 = -1))
MM_rs__2.MoveNext
MM_index__2 = MM_index__2 + 1
Wend
If (MM_rs__2.EOF) Then
MM_offset__2 = MM_index__2 ' set MM_offset__2 to the last possible record
End If
End If
%>
<%
' *** Move To Record: if we dont know the record count, check the display range
If (MM_rsCount__2 = -1) Then
' walk to the end of the display range for this page
MM_index__2 = MM_offset__2
While (Not MM_rs__2.EOF And (MM_size__2 < 0 Or MM_index__2 < MM_offset__2 + MM_size__2))
MM_rs__2.MoveNext
MM_index__2 = MM_index__2 + 1
Wend
' if we walked off the end of the recordset, set MM_rsCount__2 and MM_size__2
If (MM_rs__2.EOF) Then
MM_rsCount__2 = MM_index__2
If (MM_size__2 < 0 Or MM_size__2 > MM_rsCount__2) Then
MM_size__2 = MM_rsCount__2
End If
End If
' if we walked off the end, set the offset based on page size
If (MM_rs__2.EOF And Not MM_paramIsDefined__2) Then
If (MM_offset__2 > MM_rsCount__2 - MM_size__2 Or MM_offset__2 = -1) Then
If ((MM_rsCount__2 Mod MM_size__2) > 0) Then
MM_offset__2 = MM_rsCount__2 - (MM_rsCount__2 Mod MM_size__2)
Else
MM_offset__2 = MM_rsCount__2 - MM_size__2
End If
End If
End If
' reset the cursor to the beginning
If (MM_rs__2.CursorType > 0) Then
MM_rs__2.MoveFirst
Else
MM_rs__2.Requery
End If
' move the cursor to the selected record
MM_index__2 = 0
While (Not MM_rs__2.EOF And MM_index__2 < MM_offset__2)
MM_rs__2.MoveNext
MM_index__2 = MM_index__2 + 1
Wend
End If
%>
<%
' *** Move To Record: update recordset stats
' set the first and last displayed record
rsPublications_first = MM_offset__2 + 1
rsPublications_last = MM_offset__2 + MM_size__2
If (MM_rsCount__2 <> -1) Then
If (rsPublications_first > MM_rsCount__2) Then
rsPublications_first = MM_rsCount__2
End If
If (rsPublications_last > MM_rsCount__2) Then
rsPublications_last = MM_rsCount__2
End If
End If
' set the boolean used by hide region to check if we are on the last record
MM_atTotal__2 = (MM_rsCount__2 <> -1 And MM_offset__2 + MM_size__2 >= MM_rsCount__2)
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
Dim MM_keepNone__2
Dim MM_keepURL__2
Dim MM_keepForm__2
Dim MM_keepBoth__2
Dim MM_removeList__2
Dim MM_item__2
Dim MM_nextItem__2
' create the list of parameters which should not be maintained
MM_removeList__2 = "&index__2="
If (MM_paramName__2 <> "" Then
MM_removeList__2 = MM_removeList__2 & "&" & MM_paramName__2 & "="
End If
MM_keepURL__2=""
MM_keepForm__2=""
MM_keepBoth__2=""
MM_keepNone__2=""
' add the URL parameters to the MM_keepURL__2 string
For Each MM_item__2 In Request.QueryString
MM_nextItem__2 = "&" & MM_item__2 & "="
If (InStr(1,MM_removeList__2,MM_nextItem__2,1) = 0) Then
MM_keepURL__2 = MM_keepURL__2 & MM_nextItem__2 & Server.URLencode(Request.QueryString(MM_item__2))
End If
Next
' add the Form variables to the MM_keepForm__2 string
For Each MM_item__2 In Request.Form
MM_nextItem__2 = "&" & MM_item__2 & "="
If (InStr(1,MM_removeList__2,MM_nextItem__2,1) = 0) Then
MM_keepForm__2 = MM_keepForm__2 & MM_nextItem__2 & Server.URLencode(Request.Form(MM_item__2))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth__2 = MM_keepURL__2 & MM_keepForm__2
If (MM_keepBoth__2 <> "" Then
MM_keepBoth__2 = Right(MM_keepBoth__2, Len(MM_keepBoth__2) - 1)
End If
If (MM_keepURL__2 <> "" Then
MM_keepURL__2 = Right(MM_keepURL__2, Len(MM_keepURL__2) - 1)
End If
If (MM_keepForm__2 <> "" Then
MM_keepForm__2 = Right(MM_keepForm__2, Len(MM_keepForm__2) - 1)
End If
' a utility function used for adding additional parameters to these strings
Function MM_joinChar__2(firstItem__2)
If (firstItem__2 <> "" Then
MM_joinChar__2 = "&"
Else
MM_joinChar__2 = ""
End If
End Function
%>
<%
' *** Move To Record: set the strings for the first, last, next, and previous links
Dim MM_keepMove__2
Dim MM_moveParam__2
Dim MM_moveFirst__2
Dim MM_moveLast__2
Dim MM_moveNext__2
Dim MM_movePrev__2
Dim MM_urlStr__2
Dim MM_paramList__2
Dim MM_paramIndex__2
Dim MM_nextParam__2
MM_keepMove__2 = MM_keepBoth__2
MM_moveParam__2 = "index__2"
' if the page has a repeated region, remove 'offset' from the maintained parameters
If (MM_size__2 > 1) Then
MM_moveParam__2 = "offset__2"
If (MM_keepMove__2 <> "" Then
MM_paramList__2 = Split(MM_keepMove__2, "&"
MM_keepMove__2 = ""
For MM_paramIndex__2 = 0 To UBound(MM_paramList__2)
MM_nextParam__2 = Left(MM_paramList__2(MM_paramIndex__2), InStr(MM_paramList__2(MM_paramIndex__2),"=" - 1)
If (StrComp(MM_nextParam__2,MM_moveParam__2,1) <> 0) Then
MM_keepMove__2 = MM_keepMove__2 & "&" & MM_paramList__2(MM_paramIndex__2)
End If
Next
If (MM_keepMove__2 <> "" Then
MM_keepMove__2 = Right(MM_keepMove__2, Len(MM_keepMove__2) - 1)
End If
End If
End If
' set the strings for the move to links
If (MM_keepMove__2 <> "" Then
MM_keepMove__2 = Server.HTMLEncode(MM_keepMove__2) & "&"
End If
MM_urlStr__2 = Request.ServerVariables("URL" & "?" & MM_keepMove__2 & MM_moveParam__2 & "="
MM_moveFirst__2 = MM_urlStr__2 & "0"
MM_moveLast__2 = MM_urlStr__2 & "-1"
MM_moveNext__2 = MM_urlStr__2 & CStr(MM_offset__2 + MM_size__2)
If (MM_offset__2 - MM_size__2 < 0) Then
MM_movePrev__2 = MM_urlStr__2 & "0"
Else
MM_movePrev__2 = MM_urlStr__2 & CStr(MM_offset__2 - MM_size__2)
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>
<body>
<p>PUBS Database
</p>
<hr>
<p>Authors</p>
<hr>
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center"><% If MM_offset__1 <> 0 Then %>
<a href="<%=MM_moveFirst__1%>">First</a>
<% End If ' end MM_offset <> 0 %>
</td>
<td width="31%" align="center"><% If MM_offset__1 <> 0 Then %>
<a href="<%=MM_movePrev__1%>">Previous</a>
<% End If ' end MM_offset <> 0 %>
</td>
<td width="23%" align="center"><% If Not MM_atTotal__1 Then %>
<a href="<%=MM_moveNext__1%>">Next</a>
<% End If ' end Not MM_atTotal %>
</td>
<td width="23%" align="center"><% If Not MM_atTotal__1 Then %>
<a href="<%=MM_moveLast__1%>">Last</a>
<% End If ' end Not MM_atTotal %>
</td>
</tr>
</table>
<table border="0" cellpadding="3" cellspacing="0">
<tr>
<td>au_id</td>
<td>au_lname</td>
<td>au_fname</td>
<td>phone</td>
<td>address</td>
<td>city</td>
<td>state</td>
<td>zip</td>
<td>contract</td>
</tr>
<% While ((Repeat1__numRows <> 0) AND (NOT rsAuthors.EOF)) %>
<tr>
<td><%=(rsAuthors.Fields.Item("au_id".Value)%></td>
<td><%=(rsAuthors.Fields.Item("au_lname".Value)%></td>
<td><%=(rsAuthors.Fields.Item("au_fname".Value)%></td>
<td><%=(rsAuthors.Fields.Item("phone".Value)%></td>
<td><%=(rsAuthors.Fields.Item("address".Value)%></td>
<td><%=(rsAuthors.Fields.Item("city".Value)%></td>
<td><%=(rsAuthors.Fields.Item("state".Value)%></td>
<td><%=(rsAuthors.Fields.Item("zip".Value)%></td>
<td><%=(rsAuthors.Fields.Item("contract".Value)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsAuthors.MoveNext()
Wend
%>
</table>
<hr>
<p>Publications</p>
<hr>
<table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center"><% If MM_offset__2 <> 0 Then %>
<a href="<%=MM_moveFirst__2%>">First</a>
<% End If ' end MM_offset <> 0 %>
</td>
<td width="31%" align="center"><% If MM_offset__2 <> 0 Then %>
<a href="<%=MM_movePrev__2%>">Previous</a>
<% End If ' end MM_offset <> 0 %>
</td>
<td width="23%" align="center"><% If Not MM_atTotal__2 Then %>
<a href="<%=MM_moveNext__2%>">Next</a>
<% End If ' end Not MM_atTotal %>
</td>
<td width="23%" align="center"><% If Not MM_atTotal__2 Then %>
<a href="<%=MM_moveLast__2%>">Last</a>
<% End If ' end Not MM_atTotal %>
</td>
</tr>
</table>
<table border="0" cellpadding="3" cellspacing="0">
<tr>
<td>title_id</td>
<td>title</td>
<td>type</td>
<td>pub_id</td>
<td>price</td>
<td>advance</td>
<td>royalty</td>
<td>ytd_sales</td>
<td>notes</td>
<td>pubdate</td>
</tr>
<% While ((Repeat2__numRows <> 0) AND (NOT rsPublications.EOF)) %>
<tr>
<td><%=(rsPublications.Fields.Item("title_id".Value)%></td>
<td><%=(rsPublications.Fields.Item("title".Value)%></td>
<td><%=(rsPublications.Fields.Item("type".Value)%></td>
<td><%=(rsPublications.Fields.Item("pub_id".Value)%></td>
<td><%=(rsPublications.Fields.Item("price".Value)%></td>
<td><%=(rsPublications.Fields.Item("advance".Value)%></td>
<td><%=(rsPublications.Fields.Item("royalty".Value)%></td>
<td><%=(rsPublications.Fields.Item("ytd_sales".Value)%></td>
<td><%=(rsPublications.Fields.Item("notes".Value)%></td>
<td><%=(rsPublications.Fields.Item("pubdate".Value)%></td>
</tr>
<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
rsPublications.MoveNext()
Wend
%>
</table>
<hr>
</body>
</html>
<%
rsAuthors.Close()
Set rsAuthors = Nothing
%>
<%
rsPublications.Close()
Set rsPublications = Nothing
%>
Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS ]</font>