日期:2014-05-17 浏览次数:20903 次
<% Dim cnstr, epage, i, id id = request.QueryString("id") cnstr = "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.MapPath("./sb.mdb") Dim rs Set cn = server.CreateObject("adodb.connection") cn.Open cnstr sql = "select * from shenbao where U_ID="&id&" and S_Zt='已审核' order by S_time desc " Set rs = server.CreateObject("adodb.recordset") rs.Open sql, cn, 1, 1 If (rs.bof And rs.EOF) Then Else rs.pagesize = 20 '设置每页记录数 If request("page")<>"" Then epage = CInt(request("page")) '取当前的页数 If epage<1 Then epage = 1 '若当前页数小于1则置为1 If epage>rs.pagecount Then epage = rs.pagecount '若当前页数大于最大页数值则置为最大页数 Else epage = 1 '否则页数为默认值1 End If rs.absolutepage = epage '记录定位到当前页 For i = 0 To rs.pagesize -1 '循环显示本页记录 If rs.EOF Then Exit For '若已经到记录末尾或没有数据则退出循环 response.Write "<tr>" response.Write "<td align='left' width='40%' > "&rs("S_Cs")&"</td>" response.Write "<td align='center' width='15%'>"&rs("S_Zt")&"</td>" response.Write "<td align='center' width='15%'><a href='sbxx.asp?id="&rs("S_ID")&"' target='right'>查看</a></td>" response.Write "</tr>" rs.movenext Next End If rs.Close Set rs = Nothing %>
------解决方案--------------------
<%
dim cnstr,epage,i
cnstr = "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.MapPath("./sb.mdb")
dim rs
set cn = server.CreateObject("adodb.connection")
cn.Open cnstr
sql = "select * from shenbao order by