Forum Moderators: open

Message Too Old, No Replies

getrows() being strange..

with sql server and old style asp

         

natty

10:43 am on Jan 20, 2005 (gmt 0)

10+ Year Member



hi all

i am attempting to use getrows to return a paging area of records..
ie. getrows(20, 10) - i was expecting to return me
20 records, starting at number 10

but i am geting this error.
Current Recordset does not support bookmarks. This may be a limitation of the provider or of the selected cursortype.

or
this one

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

any ideas..
here is the code


set oConn = Server.CreateObject("ADODB.Connection")
set oRS=Server.CreateObject("ADODB.Recordset")
oConn.connectionstring="#*$!"
oConn.open

q="EXEC usp_TESTPAGING1"
oRS.Open q, oConn

if NOT (oRS.EOF or oRS.BOF) then
aResults = oRS.getRows(20,10)

ok having reviewd this, it seems that getrows will only run when the second arg is 0. ie starting at the first row.

is there some cursor setting i am missing..?

tia (i hope)

nat

CaseyRyan

3:47 pm on Jan 20, 2005 (gmt 0)

10+ Year Member




You need to use the adOpenStatic cursor type.
adOpenStatic = 3

I've also thrown in Locking Enum and Command Enum
adLockReadOnly = 1
adCmdText = 1

oRS.Open q, oConn , 3, 1, 1

With the adOpenStatic cursor type you can check the recordCount property of the recordset. Besides your line where you check for EOF and BOF I would also check that you have greater than 10 records by using the recordCount.

-=casey=-