Question

ADO recordset PageCount property returns "-1"

CONST PAGESIZE = 10
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open xSQL, Con1, 3, 3
RS.PageSize = PAGESIZE

If i try

response.write RS.PageCount

it returns -1

This was working a second ago, with a SQL

SELECT * FROM table

after i changed it to

SELECT DISTINCT field1, field2, field3 FROM table

the PageCount stopped working.

I've tried to change my query to

SELECT * FROM (SELECT DISTINCT field1, field2, field3 FROM table) aa

with no success.

I can't figure out why this is happening, please give me a hand.

Was it helpful?

Solution

This has somethign to do with my recordset (cursor) type. In the RS.Open line has 3,3 (two times) i remove one, and is now working.

CONST PAGESIZE = 10
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open xSQL, Con1, 3
RS.PageSize = PAGESIZE
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top