具体代码如下,那位高手帮解决下:
具体代码如下,那位高手帮解决下:
'初始化数据库连接
strConnection = "dsn=mydata;driver={myodbd driver};server=localhost;uid=root;pwd=123;database=member"
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open strConnection
set Rs=server.createobject("adodb.recordset")
sql="select ID,NUMTOTAL,NUMBERS,NDATATIME from num3 where NDATATIME = '"&Mytime&"' "
Rs.open sql,objConn,1,1
if not Rs.eof then
'创建临时表
objConn.execute("create temporary table tmp_table(ID INTEGER PRIMARY KEY,NUMTOTAL VARCHAR(45),NUMBERS VARCHAR(45),NDATATIME DATETIME)")
do while not Rs.eof
objConn.execute("insert into tmp_table(ID,NUMTOTAL,NUMBERS,NDATATIME) values('"&Rs("ID")&"','"&Rs("NUMTOTAL")&"','"&Rs("NUMBERS")&"','"&Rs("NDATATIME")&"')")
Rs.movenext
loop
Dim intRecordNum,intCurrentPage,intRowcount
intRowcount = 0
Dim intPageCount:intPageCount = 20 '每页20条记录
'获得总记录
Set Rs = objConn.Execute("SELECT COUNT(*) As intcounts FROM tmp_table ")
If Rs.Eof And Rs.Bof Then
intRecordNum = 0
Else
intRecordNum = Cint(Rs("intcounts"))
End If
Response.Write (""&intRecordNum&"")
Dim intTotalPages
If (intRecordNum mod intPageCount)>0 Then
intTotalPages = Int(intRecordNum/intPageCount) + 1
Else
intTotalPages = intRecordNum/intPageCount
End If
intCurrentPage = 1
Response.Write ("第一次:")
Response.Write (""&intCurrentPage&"")
Response.Write "
"
If IsEmpty(Request("intCurrentPage")) Or IsNull(Request("intCurrentPage")) Or Trim(Request("intCurrentPage"))="" Or (Not IsNumeric(Request("intCurrentPage"))) Or Len(Request("intCurrentPage"))>8 Then
intCurrentPage = 1
ElseIf Clng(Request("intCurrentPage")) < 1 Then
intCurrentPage = 1
ElseIf Clng(Request("intCurrentPage")) > intTotalPages Then
intCurrentPage = intTotalPages
Else
intCurrentPage = Clng(Request("intCurrentPage"))
End If
Response.Write "
"
Response.Write ("变化后:")
Response.Write (""&intCurrentPage&"")
' Response.End
Set Rs = Nothing
Set Rs = Server.CreateObject("ADODB.RecordSet")
strSql = "SELECT ID,NUMTOTAL,NDATATIME FROM tmp_table order by NUMTOTAL desc LIMIT " & (intCurrentPage - 1) * intPageCount & "," &intPageCount
Response.Write strSql
'Response.End
Rs.Open strSql,objConn,1,1
%>
afile="?Action=Contr2&"
showpage afile,intRecordNum,intPageCount,intCurrentPage
Rs.Close
Set Rs = Nothing
Set objPage = Nothing
%>
objConn.execute("drop table tmp_table")
End If
%>
展开