Discussion Locked

AbsolutePage returning -1

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

First may I thank everyone who replied to my last question. I closed it before giving credit but the advice was extremely helpful.

I am now trying to page the results of a search and am using the AbsolutePage property to tell me the page I am on in the recordset.

Unfortunately it is returning -1. The line of code used:

Response.Write "

Page: " & RSHits.AbsolutePage & "

"

Any ideas?

4 replies

by glen_mcleod

I'm going to assume you're using ADO.

If your Recordset object is configured as server-side then properties such as AbsolutePage and Recordcount will always return -1. It's because that information isn't sent to the Recordset object, it's kept on the database server. Server-side in ADO refers to the database server and not the IIS server.

Try setting the Recordset's CursorLocation property to adUseClient (or the numeric equivelent).

Glen

by munrrob

Further Info:

I am using ADO to write an ASP page. If I try to set the properties individually using this code:
'Create the recordset object
set RSHits = Server.CreateObject("ADODB.Recordset")
RSHits.CursorType=adOpenStatic
RSHits.CursorLocation=adUseClient
RSHits.ActiveConnection=conn
RSHits.Open SQLString
I get the following error in the browser:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
I return a valid recrdset if I use:
RSHits.open SQLString, conn, 3, 3
but return a -1 when using the ActivePAge property of the recordset.

This discussion is closed to new replies.