Welcome to WebmasterWorld Guest from 184.108.40.206
Forum Moderators: ocean10000
i posted a question not long ago about getrows, which altho i know is not the preffered method of paging (over stored procs..)
but having looked at the usage i find the follwing..
rows = value that specifies the number of records to retrieve.
start = Optional. What record to start on, a record number or a BookmarkEnum value
fields = Optional. If you want to specify only the fields that the GetRows call will return, it is possible to pass a single field name/number or an array of field names/numbers in this argument
and i am trying to use getrows liek this
oRS.Open q, oConn, 3, 1, 1
'i am told i need adOpenStatic - 3 for this to work
startRec = 10
numnPerPage = 15
if not (oRS.EOF or oRS.BOF) then
aRecs = oRS.GetRows(numPerPage, startRec)
what actually happens is the following (and yes there are recs to return)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/admin/codeinfo_test.asp, line 26
line 26 being the aRecs = oRS.getRows(x,y) line
btw in case it matters, using sql server as db
Optional. A GetRowsOptionEnum value that indicates the number of records to retrieve. The default is adGetRowsRest.
Optional. A String value or Variant that evaluates to the bookmark for the record from which the GetRows operation should begin. You can also use a BookmarkEnum value.
Optional. A Variant that represents a single field name or ordinal position, or an array of field names or ordinal position numbers. ADO returns only the data in these fields.
Never played with the Start param of GetRows but it looks like your problem might be that "Start" doesn't do quite what you think it does (in that it seems to expect a bookmark value rather than a literal).
I'd try removing your "start" variable then checking if it works - if it does then there's your culprit.
As an alternative would calling a
before you fire off a
Also might just be a posting typo, but you're calling the variable "numnPerPage" when you set it but then "numPerPage" in the call.
thanks for the reply.
yes, as the name of the topic sugegsted, i figured i was misunderstanding something.
for me getrows is all about not having to mess with cursors and movenext type actions. saving time and load, even if it leaves code not especially readable.
removing the start variable, would somewhat kill the whole idea, being as i am trying to use this for paging, and its not much good if i cant specify which record to start on.
the explanation i got of getrows was from w3schools, and im not so 'au fait' with the whole cursor thing, i will try the oRS.move before the call, as like you say, its seems the start is the problem, so if i can set that with a move, then grab all that remains (or actually the numPerPage amount more records) with getrows, i may be away :)
ps. yes the typo was purely on here.
Using start and num of records with GetRows will not neccessarily speed up your page, as the database/ADO still has to run the whole query, then do some additional jiggery-pokery to narrow this resultset down to a subset of records. YMMV...