There is no normal method of looping td within loop tr, so the number of record sets on the last page is not calculated.
However, when the record set is insufficient, it can also automatically fill in empty rows and columns. If there is any deficiency, please point it out, thank you.
How to use is very simple:
The code copy is as follows:
<%
showData("query name")
Callpagehead (number of rows, columns)
'-------------------------------------------------------------------------------
'You can write the following Response.Write() into the function to see your personal hobbies.
Response.Write(FormatCRtable(Table width, table height))
Response.Write(PageFoot())
CallcloseData()
%>
The function is as follows:
The code copy is as follows:
<%
'-------------------------------------------------------------------------------
'Copyright2005byJorkin.AllRightsReserved
'-------------------------------------------------------------------------------
Publicrs
Publicpageno, Cols, Rows, maxpageno, maxredcount, maxpagesize
'-------------------------------------------------------------------------------
PublicFunctionshowData(sqlstrings)
Setrs=Server.CreateObject("ADODB.Recordset")
rs.opensqlstrings,oconn,1,3
EndFunction
PublicFunctioncloseData()
rs.close
Setrs=Nothing
EndFunction
'Initialize the pagination
'MaxRows=Maximum number of rows
'MaxCols=Maximum number of columns
'-------------------------------------------------------------------------------
PublicFunctionPageHead(MaxRows,MaxCols)
'-------------------------------------------------------------------------------
Rows=MaxRows
Cols=MaxCols
maxpagesize=1
maxredcount=0
maxpageno=0
pageno=0
'-------------------------------------------------------------------------------
maxredcount=rs.recordcount
Ifmaxredcount>0then
maxpagesize=Rows*Cols
maxpageno=Cint((maxredcount+maxpagesize-1)/maxpagesize)
rs.pagesize=maxpagesize
pageno=Request("pageno")
IfIsEmpty(pageno)OrNotIsNumeric(pageno)OrCInt(pageno)<1OrCInt(pageno)>Rs.PagecountThen
Pageno=1
EndIf
rs.absolutePage=pageno
EndIf
OnErrorResumeNext
EndFunction
'The end of the page function
'No parameters
'-------------------------------------------------------------------------------
PublicFunctionPageFoot()