<% @ Language = "VBScript" codePage = "65001" %>
<! -- # Include file = "Connections/Conn. asp" -->
<%
Dim recordset1
Dim recordset1_cmd
Dim recordset1_numrows
Set recordset1_cmd = server. Createobject ("ADODB. Command ")
Recordsetask).activeconnection = mm_conn_string
Recordsetask).commandtext = "select * from List"
Recordsetpaipai.prepared = true
Set recordset1 = recordset00000000.execute
Recordset1_numrows = 0
%>
<%
Dim repeat1 _ numrows
Dim repeat1 _ Index
Repeat1 _ numrows = 2
Repeat1 _ Index = 0
Recordset1_numrows = recordset1_numrows + repeat1 _ numrows
%>
<%
* ** Recordset stats, move to record, and go to record: declare stats Variables
Dim recordset1_total
Dim recordset1_first
Dim recordset1_last
'Set the record count
Recordset1_total = recordset1.recordcount
'Set the number of rows displayed on this page
If (recordset1_numrows <0) then
Recordset1_numrows = recordset1_total
Elseif (recordset1_numrows = 0) then
Recordset1_numrows = 1
End if
'Set the first and last displayed record
Recordsetaskfirst = 1
Recordset1_last = recordset1_first + recordset1_numrows-1
'If we have the correct record count, check the other stats
If (recordset1_total <>-1) then
If (recordset1_first> recordset1_total) then
Recordsetaskfirst = recordsetasktotal
End if
If (recordset1_last> recordset1_total) then
Recordsetasklast = recordsetasktotal
End if
If (recordset1_numrows> recordset1_total) then
Recordset1_numrows = recordset1_total
End if
End if
%>
<%
* ** Recordset stats: if we don't know the record count, manually count them
If (recordset1_total =-1) then
'Count the total records by iterating through the recordset
Recordsetasktotal = 0
While (not recordset1.eof)
Recordset1_total = recordset1_total + 1
Recordset1.movenext
Wend
'Reset the cursor to the beginning
If (recordset1.cursortype> 0) then
Recordset1.movefirst
Else
Recordset1.requery
End if
'Set the number of rows displayed on this page
If (recordset1_numrows <0 or recordset1_numrows> recordset1_total) then
Recordset1_numrows = recordset1_total
End if
'Set the first and last displayed record
Recordsetaskfirst = 1
Recordset1_last = recordset1_first + recordset1_numrows-1
If (recordset1_first> recordset1_total) then
Recordsetaskfirst = recordsetasktotal
End if
If (recordset1_last> recordset1_total) then
Recordsetasklast = recordsetasktotal
End if
End if
%>
<%
Dim mm_paramname
%>
<%
'*** Move to record and go to record: declare Variables
Dim mm_rs
Dim mm_rscount
Dim mm_size
Dim mm_uniquecol
Dim mm_offset
Dim mm_attotal
Dim mm_paramisdefined
Dim mm_param
Dim mm_index
Set mm_rs = recordset1
Mm_rscount = recordset1_total
Mm_size = recordset1_numrows
Mm_uniquecol = "ID"
Mm_paramname = "page"
Mm_offset = 0
Mm_attotal = false
Mm_paramisdefined = false
If (mm_paramname <> "") then
Mm_paramisdefined = (request. querystring (mm_paramname) <> "")
End if
%>
<%
* ** Move to record: handle 'index' or 'offset 'Parameter
If (not mm_paramisdefined and mm_rscount <> 0) then
'Use index parameter if defined, otherwise use offset parameter
Mm_param = request. querystring ("Index ")
If (mm_param = "") then
Mm_param = request. querystring ("offset ")
End if
If (mm_param <> "") then
Mm_offset = int (mm_param)
End if
'If we have a record count, check if we are past the end of the recordset
If (mm_rscount <>-1) then
If (mm_offset> = mm_rscount or mm_offset =-1) Then 'past end or move last
If (mm_rscount mod mm_size)> 0) Then 'last page not a full repeat region
Mm_offset = mm_rscount-(mm_rscount mod mm_size)
Else
Mm_offset = mm_rscount-mm_size
End if
End if
End if
'Move the cursor to the selected record
Mm_index = 0
While (not mm_rs.eof) and (mm_index <mm_offset or mm_offset =-1 ))
Mm_rs.movenext
Mm_index = mm_index + 1
Wend
If (mm_rs.eof) then
Mm_offset = mm_index 'set mm_offset to the last possible record
End if
End if
%>
<%
'*** Move to specific record: handle detail Parameter
If (mm_paramisdefined and mm_rscount <> 0) then
'Get the value of the Parameter
Mm_param = request. querystring (mm_paramname)
'Find the record with the unique column value equal to the parameter value
Mm_offset = 0
Do While (not mm_rs.eof)
If (CSTR (mm_rs.fields.item (mm_uniquecol). Value) = mm_param) then
Exit do
End if
Mm_offset = mm_offset + 1
Mm_rs.movenext
Loop
'If not found, set the number of records and reset the cursor
If (mm_rs.eof) then
If (mm_rscount <0) then
Mm_rscount = mm_offset
End if
If (mm_size <0 or mm_size> mm_offset) then
Mm_size = mm_offset
End if
Mm_offset = 0
'Reset the cursor to the beginning
If (mm_rs.cursortype> 0) then
Mm_rs.movefirst
Else
Mm_rs.close
Mm_rs.open
End if
End if
End if
%>
<%
'*** Move to record: If we dont know the record count, check the display range
If (mm_rscount =-1) then
'Walk to the end of the display range for this page
Mm_index = mm_offset
While (not mm_rs.eof and (mm_size <0 or mm_index <mm_offset + mm_size ))
Mm_rs.movenext
Mm_index = mm_index + 1
Wend
'If we have Ed off the end of the recordset, set mm_rscount and mm_size
If (mm_rs.eof) then
Mm_rscount = mm_index
If (mm_size <0 or mm_size> mm_rscount) then
Mm_size = mm_rscount
End if
End if
'If we have Ed off the end, set the offset based on page size
If (mm_rs.eof and not mm_paramisdefined) then
If (mm_offset> mm_rscount-mm_size or mm_offset =-1) then
If (mm_rscount mod mm_size)> 0) then
Mm_offset = mm_rscount-(mm_rscount mod mm_size)
Else
Mm_offset = mm_rscount-mm_size
End if
End if
End if
'Reset the cursor to the beginning
If (mm_rs.cursortype> 0) then
Mm_rs.movefirst
Else
Mm_rs.requery
End if
'Move the cursor to the selected record
Mm_index = 0
While (not mm_rs.eof and mm_index <mm_offset)
Mm_rs.movenext
Mm_index = mm_index + 1
Wend
End if
%>
<%
'*** Move to record: Update recordset stats
'Set the first and last displayed record
Recordsetaskfirst = mm_offset + 1
Recordset1_last = mm_offset + mm_size
If (mm_rscount <>-1) then
If (recordset1_first> mm_rscount) then
Recordsetaskfirst = mm_rscount
End if
If (recordset1_last> mm_rscount) then
Recordsetasklast = mm_rscount
End if
End if
'Set the Boolean used by hide region to check if we are on the last record
Mm_attotal = (mm_rscount <>-1 and mm_offset + mm_size> = mm_rscount)
%>