Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with paging records

Status
Not open for further replies.

Herminio

Technical User
May 10, 2002
189
PT
i'm trying to put a paging record that i found on the net in my page, i think everything is ok, but i get an error that i've never seen before, here's my code:

<%@LANGUAGE=&quot;VBSCRIPT&quot; CODEPAGE=&quot;1252&quot;%>
<%
'Variáveis
Dim conn
Dim strCon
Dim ass
Dim id
Dim sql
Dim PgSz
Dim CurrPg
Dim PgCt
%>
<%
if Request.QueryString(&quot;Id&quot;) = &quot;&quot; or Request.QueryString(&quot;Id&quot;) = null then
id = 1
else
id = Request.QueryString(&quot;Id&quot;)
end if
%>
<%
PgSz = 2 'number of records per page

If Request(&quot;Page&quot;) = &quot;&quot; Then
CurrPg = 1
Else
CurrPg = CInt(Request(&quot;Page&quot;))
End If
%>
<%
Set conn = Server.CreateObject(&quot;ADODB.connection&quot;)
strCon = &quot;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=&quot; & Server.MapPath(&quot;opiniao.mdb&quot;)
conn.open strcon
sql = &quot;SELECT * FROM Assuntos WHERE Idsubcat = &quot;&Id&&quot; and status=1&quot;
set ass = conn.execute(sql)

ass.PageSize = PgSz
PgCt = ass.PageCount
%>
<html>
<head>
<title>Vota&ccedil;&atilde;o</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body>
<!--#include file=&quot;search.inc&quot;-->
<p>
<% If ass.eof Then %>
Não Existem Votações nesta Sub-Categoria </p>
<% Else %>
<%= Request.QueryString(&quot;mess&quot;) %>
<%
If 1 > CurrPg Then CurrPg = 1
If CurrPg > PgCt Then CurrPg = PgCt

ass.AbsolutePage = CurrPg <-- Line 56
%>
<table width=&quot;75%&quot; border=&quot;0&quot;>
<%
Do While ass.AbsolutePage = CurrPg And Not ass.EOF
%>
<tr>
<td> </td>
<td><%= ass(&quot;Assunto&quot;) %></td>
<td><a href=&quot;results.asp?id=<%= ass(&quot;idAssunto&quot;) %>&quot;>Ver Resultados</a></td>
</tr>
<tr>
<td colspan=&quot;2&quot;>
<form name=&quot;poll&quot; method=&quot;post&quot; action=&quot;update.asp?id=<%= ass(&quot;IdAssunto&quot;) %>&quot;>
<label>
<input type=&quot;radio&quot; name=&quot;hip&quot; value=&quot;1&quot;>
</label>
<%= ass(&quot;Perg1&quot;) %><br>
<label>
<input type=&quot;radio&quot; name=&quot;hip&quot; value=&quot;2&quot;>
</label>
<%= ass(&quot;Perg2&quot;) %><br>
<label>
<input type=&quot;radio&quot; name=&quot;hip&quot; value=&quot;3&quot;>
<%= ass(&quot;Perg3&quot;) %><br>
<input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;votar&quot;>
</label>
</form>
</td>
</tr>
<% ass.movenext %>
<%
loop
%>
</table>
<% End If %>

<%
'Navigation System
If CurrPg <> 1 Then %>
<a href='polls.asp?id=&quot; &id& &quot; and page=&quot; &CurrPg -1'>
Previous</a>
<%
End If
%>

<%
If CurrPg < PgCt Then %>
<a href='polls.asp?id=&quot; &id& and page=&quot; &CurrPg +1'>
Next</a>
<%
End If
'End Navigation System
%>
</body>
</html>
<%
ass.Close()
Set ass = Nothing
%>


This is the error


Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/opinião/polls.asp, line 56
 
Double check the values for curpage, it looks to me that you may be going over the maximum value for your attribute.

-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top