Need help with GetRows

D

Dave Li

Hi All

I'm using GetRows to reutrn all of my records from an recordset in ASP, but
when I trying to use it in Access 2002. I found it doesn't return all the
records unless you sepecify the number of the rows that you wan to return.

I checked MSDN it is saying it will return all records by default! I'm
confused. Please give some help on this.

I'm using GetRows like this:
rst.GetRows()

Thanks in advance.

Best regards,
Dave
 
D

Dirk Goldgar

Dave Li said:
Hi All

I'm using GetRows to reutrn all of my records from an recordset in
ASP, but when I trying to use it in Access 2002. I found it doesn't
return all the records unless you sepecify the number of the rows
that you wan to return.

I checked MSDN it is saying it will return all records by default! I'm
confused. Please give some help on this.

I'm using GetRows like this:
rst.GetRows()

Thanks in advance.

Best regards,
Dave

I don't know much about ASPs, but ...

What kind of recordset are you dealing with -- and ADO recordset or a
DAO recordset? They both have a GetRows method, but only the ADO
recordset's GetRows method defaults to retrieving all the rows.

If you need to specify the number of rows to retrieve, you could pick an
arbitrarily large number of rows; e.g.,

vRows = rst.GetRows(99999999)

Or you could find out how many rows there are in the recordset (so long
as it isn't a forward-only recordset), and retrieve that many:

With rst
.MoveLast
.MoveFirst
vRows = rst.GetRows(.RecordCount)
.Close ' assuming you want to do this
End With
 
D

Dave Li

Hi Dirk

Thanks a lot. What I didn't do was the MoveLast and MoveFirst, so the
RecordCount return 0 and I was stucked there. It is working perfectly now.

Thanks.

Best regards,
Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top