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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Paging through Recorset Error

Status
Not open for further replies.

duckweb

Programmer
Mar 4, 2003
12
US
I'm trying to use paging functionality in ASP...i know my code works, b/c I used in a previous job. However, I am trying to do this now, but keep getting the following error:

ADODB.Recordset error '800a0cb3'

Object or provider is not capable of performing requested operation.

/paging.asp, line 61

Line 61 is below:
rsData.AbsolutePage = iPage

No matter what i do, it always crashes out on this "absolutepage" thing. Doesn't matter if I'm connecting to Access or Oracle. I also use adUseClient, but that doesn't work either. Running Win 2K IIS 5. I'm clueless here!
 
hi,

me using this , haven't come across this problem .... but then just a checklist

1.] hope u not disconnecting the recordset
rs.Activeconnection = Nothing

2.] Value passed in the iPage variable is a valid page

also if u can paste a fwe more lines of code , we can better understand the problem

[cheers]
Niraj [noevil]
 
Here is the code. This is the line where my error says its not capable of performing the transaction:

rsData.AbsolutePage = iPage

<%
Dim rsData
Dim iPage
Dim iTotalPages
Dim fldF
Dim iRec
Dim sQuote
Dim sMe
Dim sRecs

sQuote = Chr(34) ' the double quote character


Set conn = server.CreateObject(&quot;ADODB.Connection&quot;)
Set rsData = server.CreateObject(&quot;ADODB.Recordset&quot;)

rsData.PageSize = 5
sql = &quot;SELECT * FROM TB_DUSTORE_PRODUCTS&quot;

conn.connectionstring = application(&quot;Development_ConnectionString&quot;)
conn.Open
set rsData = conn.execute(sql)


' get the requested data
If Request.QueryString(&quot;PAGE&quot;) = &quot;&quot; Then
iPage = 1
Else
' protect against out of range pages, in case
' of a user specified page number
iPage = CInt(Request.QueryString(&quot;PAGE&quot;))
If iPage < 1 Then
iPage = 1
Else
If iPage > rsData.PageCount Then
iPage = rsData.PageCount
End If
End If
End If

' set the page
rsData.AbsolutePage = iPage

' start building the table
Response.Write &quot;<TABLE BORDER=1><THEAD><TR>&quot;
For Each fldF In rsData.Fields
Response.Write &quot;<TD>&quot; & fldF.Name & &quot;</TD>&quot;
Next
Response.Write &quot;</TR></THEAD><TBODY>&quot;

' now loop through the records for this page
For iRec = 1 To rsData.PageSize
If Not rsData.EOF Then
Response.Write &quot;<TR>&quot;
For Each fldF In rsData.Fields
Response.Write &quot;<TD>&quot; & fldF.Value & &quot;</TD>&quot;
Next
Response.Write &quot;</TR>&quot;
rsData.MoveNext
End If
Next
Response.Write &quot;</TBODY></THEAD></TABLE><P>&quot;

' now some paging controls
sMe = Request.ServerVariables(&quot;SCRIPT_NAME&quot;)

' only give active first page if we aren't already on it
If iPage = 1 Then
Response.Write &quot;&nbsp;<SPAN>First Page</SPAN>&quot;
Else
sRecs = &quot; (1-&quot; & rsData.PageSize & &quot;)&quot;
Response.Write &quot;&nbsp;<A HREF=&quot; & sQuote & sMe & &quot;?PAGE=1&quot; & _
sQuote & &quot;>First Page &quot; & sRecs & &quot;</A>&quot;
End If

' only give an active previous page if there are previous pages
If iPage = 1 Then
Response.Write &quot;&nbsp;<SPAN>Previous Page</SPAN>&quot;
Else
iRec = rsData.PageSize * iPage - 1
sRecs = &quot; (&quot; & iRec - rsData.PageSize & &quot;-&quot; & iRec & &quot;)&quot;
Response.Write &quot;&nbsp;<A HREF=&quot; & sQuote & sMe & &quot;?PAGE=&quot; & iPage - 1 & _
sQuote & &quot;>Previous Page&quot; & sRecs & &quot;</A>&quot;
End If

' only give an active next page if there are more pages
If iPage = rsData.PageCount Then
Response.Write &quot;&nbsp;<SPAN>Next Page</SPAN>&quot;
Else
iRec = rsData.PageSize * iPage + 1
sRecs = &quot; (&quot; & iRec & &quot;-&quot; & iRec + rsData.PageSize & &quot;)&quot;
Response.Write &quot;&nbsp;<A HREF=&quot; & sQuote & sMe & &quot;?PAGE=&quot; & iPage + 1 & _
sQuote & &quot;>Next Page&quot; & sRecs & &quot;</A>&quot;
End If

' only give active last page if not already on it
If iPage = rsData.PageCount Then
Response.Write &quot;&nbsp;<SPAN>Last Page</SPAN>&quot;
Else
iRec = rsData.PageSize * rsData.PageCount
sRecs = &quot; (&quot; & iRec - rsData.PageSize & &quot;-&quot; & iRec & &quot;)&quot;
Response.Write &quot;&nbsp;<A HREF=&quot; & sQuote & sMe & &quot;?PAGE=&quot; & rsData.PageCount & _
sQuote & &quot;>Last Page&quot; & sRecs & &quot;</A>&quot;
End If

' and clear up
rsData.Close
Set rsData = Nothing
%>
 
ummm .. look fine but

try using this

with rsData
.open sql,conn,3
.pagesize = cint(5)
end if

i.e after opening a recordset set the pagesize etc !

not very sure but then this works for me ...

[cheers]
Niraj [noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top