mysql创建临时表 分页_ASP+MySQl利用临时表分页第一页数据正常,下一页往后没有数据...

具体代码如下,那位高手帮解决下:

具体代码如下,那位高手帮解决下:

'初始化数据库连接

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

%>

展开

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值